<template>
    <rm-layout-bottom :canDrag="false" :fixsize="20" :splitwidth="0">
        <rm-layout-top :canDrag="false" :fixsize="96" :splitwidth="0">
            <template v-slot:fix>
                <table class="table1style">
                    <tr>
                        <td>
                            <el-select v-model="options.cardtype" @change="testchange()" style="width: 110px">
                                <el-option v-for="item in options.cardtypeOption" :key="item.value" :value="item.value" :label="item.label"></el-option>
                            </el-select>
                        </td>
                        <td :style="`width: ${options.inputboxuseenglishmode == '1' ? 380 : 280}px;`">
                            <div v-if="options.inputboxuseenglishmode == '1'" style="width: 100%; display: inline-block">
                                <el-input ref="txtinputno" v-model="inputno" type="password" autocomplete="off" @focus="inputnogetfocus()" style="width: 49%" @keyup.enter.native="txtinputno_enter" :disabled="txtinputnodisabled"></el-input>
                                <el-input v-model="inputno" disabled class="showbottleno" style="width: 49%"></el-input>
                            </div>
                            <el-input v-else v-model="inputno" ref="txtinputno" :disabled="txtinputnodisabled" @keyup.enter.native="txtinputno_enter" @focus="inputnogetfocus()" style="width: 100%"></el-input>
                        </td>
                        <td style="width: 60px">
                            <el-button @click="readcard()" style="width: 100%">读IC卡({{ options.f1 }})</el-button>
                        </td>
                        <td style="width: 30px; text-align: right; min-width: 30px">日期</td>
                        <td>
                            <el-date-picker v-model="querydate1" type="date" :clearable="false" align="right" style="width: 100%" unlink-panels placeholder="开始日期" size="mini" @change="querydate_change" value-format="yyyy-MM-dd" :picker-options="pickerOptions"> </el-date-picker>
                        </td>
                        <td>至</td>
                        <td>
                            <el-date-picker v-model="querydate2" type="date" :clearable="false" align="right" style="width: 100%" unlink-panels placeholder="结束日期" size="mini" @change="querydate_change" value-format="yyyy-MM-dd"> </el-date-picker>
                        </td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="chk_fixeddate" @change="fixeddateChange()">固定日期</el-checkbox>
                        </td>
                        <td style="text-align: right; width: 30px; min-width: 30px">姓名</td>
                        <td>
                            <el-input v-model="patname" ref="txtpatname" @keyup.enter.native="querycxpatlist" style="width: 100%"></el-input>
                        </td>
                        <td v-if="options.showpatlist">
                            <el-button icon="el-icon-search" @click="querycxpatlist" style="width: 100%"></el-button>
                        </td>
                        <td v-if="options.bshowqueue">
                            <el-button @click="addqueue" style="width: 100%">新增排队</el-button>
                        </td>
                        <td></td>
                        <td>
                            <el-button icon="el-icon-printer" style="width: 100%; display: none"> 批量打印</el-button>
                        </td>
                        <td></td>
                    </tr>
                    <tr style="height: 30px; vertical-align: middle">
                        <td v-if="barscandispay">条码扫描区域</td>
                        <td v-else></td>
                        <td v-if="barscandispay">
                            <el-input :class="{ csstxtbarsacn: isErr }" ref="txtbarsacn" @focus="barscanfocus" :disabled="barscandisabled" v-model="barmsg" @keyup.enter.native="barsacn()" style="width: 100%"></el-input>
                        </td>
                        <td colspan="4" v-else>
                            <el-checkbox v-show="options.showprintreceipt == '1'" v-model="bPrintBackBill">打印回单</el-checkbox>
                            <el-checkbox v-if="options.req110showsecrecy == '1'" v-model="bNameEncrypt">病人信息加密</el-checkbox>
                            <el-checkbox v-has="'PSHOWDUP'" v-model="bShowRepeatItem">显示已采集项目</el-checkbox>
                            <el-checkbox v-show="options.printbarcodemodel == 1" v-model="IsPrintBarcode">仅生成条码不打印 </el-checkbox>
                        </td>
                        <td colspan="10">
                            <label v-if="overmoneydispay"> 余额：</label><label v-if="overmoneydispay" style="color: blue">{{ overmoney }}</label> <label v-if="sampledcntdispay"> 采样数：</label><label v-if="sampledcntdispay" style="color: blue">{{ sampledcnt }}</label> <label v-if="sampledcntdispay"> 人次数：</label><label v-if="sampledcntdispay" style="color: blue">{{ personcnt }}</label>
                        </td>
                    </tr>
                </table>

                <table class="btntable">
                    <tr>
                        <td>
                            <el-button type="310" @click="txtinputno_enter('1')" icon="el-icon-search">查询({{ options.f5 }})</el-button>
                        </td>
                        <td>
                            <el-button v-if="options.prebarcodemode == '1'" type="310" :disabled="prtbtndisabled" icon="el-icon-circle-check" @click="btnPrint_click()">完成</el-button>
                            <el-button v-else type="310" :disabled="prtbtndisabled" icon="el-icon-printer" :clickDelay="2000" @click="btnPrint_click()">打印({{ options.f2 }}) </el-button>
                        </td>
                        <td>
                            <el-button type="310" icon="el-icon-refresh-left" @click.native="btnreset_click">复位(C)</el-button>
                        </td>
                        <td>
                            <el-button type="310" v-if="!prtbtndisabled" @click="btnPrint_click(2)" icon="el-icon-printer">单打条码(B)</el-button>
                            <el-button type="310" v-else :disabled="reprtbtndisabled" @click="btnRePrint_click('bar')" icon="el-icon-printer">重打条码(B)</el-button>
                        </td>
                        <td>
                            <el-button type="310" :disabled="reprtbtndisabled" @click="btnRePrint_click('back')" icon="el-icon-printer">重打回单(L)</el-button>
                        </td>
                        <td>
                            <el-button type="310" @click="btnCancel_click" :disabled="cancelbtndisabled" icon="el-icon-refresh-left">取消采样</el-button>
                        </td>
                        <td>
                            <el-button type="310" @click="btnCamera_click" :disabled="camerabtndisabled" icon="el-icon-camera">捕获</el-button>
                        </td>
                    </tr>
                </table>
            </template>
            <el-tabs v-model="activeName" style="height: 100%" @tab-click="tabs_click" type="border-card">
                <el-tab-pane name="curtab">
                    <span slot="label"><i class="el-icon-check"></i>当前采样</span>

                    <div v-if="noorders" style="position: absolute; z-index: 1; top: 100px; left: 300px; font-size: 28px; color: blue">时间段内没有病人的待采样医嘱</div>

                    <rm-layout-right v-if="this.options.isenablemix == '1'" splitcolor="#F8F8FF" movingcolor="#e7e7ee" :splitwidth="5" :fixsize="475" :minfixsize="300">
                        <vxe-table
                            :pager-config="tablePage"
                            show-overflow="tooltip"
                            :data="curTableData"
                            @cell-dblclick="curtable_celldblclick"
                            :cell-class-name="curtable_cellClassName"
                            :row-class-name="curtable_rowClassName"
                            :loading="curloading"
                            border
                            height="auto"
                            ref="tbCurSample"
                            resizable
                            size="mini"
                            stripe
                            :edit-config="{
                                trigger: 'click',
                                mode: 'cell',
                                showStatus: false,
                                activeMethod: ActiveMethod,
                                showIcon: false,
                            }"
                            :span-method="rowspanmethod"
                        >
                            <vxe-table-column :field="items.field" :title="items.title" :width="items.width" v-for="items in options.Cols" v-bind:key="items.field" align="center" header-align="center" :edit-render="items.field == 'sample_detail' ? { name: 'input', autoselect: true } : null" :formatter="items.field == 'emer_flag' ? formatterEmerFlag : null">
                                <template v-slot:edit="{ row }" v-if="items.field == 'sample_detail'">
                                    <el-input v-model="row.sample_detail" style="width: 100%" placeholder=""> </el-input>
                                </template>

                                <template v-slot:header="{ column }" v-if="items.field == 'specimen_name'">
                                    <el-tooltip content="双击可以修改标本类型" placement="top-start">
                                        <span>标本类型</span>
                                    </el-tooltip>
                                </template>
                                <template v-slot:header="{ column }" v-else-if="items.field == 'strselect'">
                                    <el-checkbox v-model="selectall" @change="chkselectall_change($event)"></el-checkbox>
                                </template>
                                <template v-slot:header="{ column }" v-else-if="items.field == 'emer_flag'">
                                    <el-tooltip content="双击可以修改急诊标志" placement="top-start">
                                        <span>急</span>
                                    </el-tooltip>
                                </template>
                                <template v-slot="{ row }" v-if="items.field == 'req_groupna'">
                                    <div v-bind:style="{ background: row.req_groupcolor_b, color: row.req_groupcolor }">
                                        {{ row.req_groupna }}
                                    </div>
                                </template>
                                <template v-slot="{ row }" v-else-if="items.field == 'req_barcode_head'">
                                    <div v-bind:style="{ background: row.req_groupcolor_b, color: row.req_groupcolor }">
                                        {{ row.req_barcode_head }}
                                    </div>
                                </template>
                                <template v-slot="{ row }" v-else-if="items.field == 'strselect'">
                                    <el-checkbox v-model="row.bselect" v-if="row.strselect == '-1'" disabled="disabled" :key="0"></el-checkbox>
                                    <el-checkbox v-model="row.bselect" v-else-if="row.strselect == '0'" :key="0" @change="chkselect_change($event, { row })"></el-checkbox>
                                    <el-checkbox v-model="row.bselect" v-else @change="chkselect_change($event, { row })" checked="checked" :key="1"></el-checkbox>
                                </template>
                                <template v-slot="{ row }" v-else-if="items.field == 'item_price'">
                                    <div v-if="options.barcodeisorignalno == '1' && options.cxorignalnobatchselect == '1' && options.mergedisplaybarcode == '1'">{{ row.displayprice }}</div>
                                    <div v-else>{{ row.item_price }}</div>
                                </template>
                                <template v-slot="{ row }" v-else-if="items.field == 'qty'">
                                    <div v-if="options.barcodeisorignalno == '1' && options.cxorignalnobatchselect == '1' && options.mergedisplaybarcode == '1'">{{ row.displayitemcnt }}</div>
                                    <div v-else>{{ row.qty }}</div>
                                </template>
                                <template v-slot="{ row }" v-else-if="items.field == 'amount'">
                                    <div v-if="options.barcodeisorignalno == '1' && options.cxorignalnobatchselect == '1' && options.mergedisplaybarcode == '1'">{{ row.displayamount }}</div>
                                    <div v-else>{{ row.amount }}</div>
                                </template>
                            </vxe-table-column>
                            <template v-slot:fix>
                                <div style="font-size: 40px; padding-left: 3px; background-color: #fff; overflow: auto; text-align: right">
                                    <span style="font-weight: bold; margin-right: 18px; color: red">{{ barcnt }}</span>
                                </div>
                            </template>
                        </vxe-table>

                        <template v-slot:fix>
                            <vxe-table show-overflow="tooltip" :data="mixTableData" :loading="mixloading" border height="auto" ref="mixTable" size="mini" show-header-overflow highlight-current-row resizable stripe>
                                <vxe-table-column title="删除" width="40px" align="center">
                                    <template v-slot="{ row }">
                                        <i class="el-icon-delete" style="padding: 5px 10px !important" @click="removedetailEvent(row)"></i>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column type="index" title="序号" width="40" :index-method="indexMethod" header-align="center" align="center"></vxe-table-column>
                                <vxe-table-column field="barcode" title="样本条码号" width="100" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_name" title="病人姓名" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_sexname" title="性别" width="60" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_agestr" title="年龄" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_no" title="病人号" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_idcardno" title="身份证号" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_phone" title="联系电话" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="add_dt" title="混样时间" width="120" header-align="center"></vxe-table-column>
                                <vxe-table-column field="add_username" title="混样人" width="120" header-align="center"></vxe-table-column>
                                <vxe-table-column field="sample_items" title="项目描述" width="100" header-align="center"></vxe-table-column>
                                <vxe-table-column field="specimen_name" title="标本类型" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="req_docname" title="申请医生" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="req_deptname" title="申请科室" width="80" header-align="center"></vxe-table-column>
                                <!-- <vxe-table-column field="validflag" title="有效标志" width="80" header-align="center"></vxe-table-column> -->
                                <!-- <vxe-table-column field="inp_date" title="入院时间" width="80" header-align="center"></vxe-table-column> -->
                                <!-- <vxe-table-column field="pat_diag" title="临床诊断" width="80" header-align="center"></vxe-table-column> -->
                                <vxe-table-column field="pat_address" title="病人联系地址" width="80" header-align="center"></vxe-table-column>
                                <!-- <vxe-table-column field="pat_nation" title="国家/民族" width="80" header-align="center"></vxe-table-column> -->
                                <vxe-table-column field="pat_cardno" title="就诊卡号" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="inp_id" title="住院标识" width="80" header-align="center"></vxe-table-column>
                                <vxe-table-column field="pat_id" title="病人唯一号" width="80" header-align="center"></vxe-table-column>
                                <!-- <vxe-table-column field="req_wardno" title="病人病区" width="80" header-align="center"></vxe-table-column> -->
                                <!-- <vxe-table-column field="req_bedno" title="病人床号" width="80" header-align="center"></vxe-table-column> -->
                                <vxe-table-column field="mixbarcode" title="混检条码号" width="80" header-align="center"></vxe-table-column>
                                <!-- <vxe-table-column field="recieve_dt" title="检验科接收时间" width="100" header-align="center"></vxe-table-column>
                                <vxe-table-column field="recieve_user" title="检验科接收用户" width="100" header-align="center"></vxe-table-column> -->
                                <template v-slot:fix>
                                    <div style="font-size: 14px; height: 28px; padding-left: 3px; background-color: #fff; overflow: auto">
                                        <span>
                                            <span style="color: blue; font-weight: bold; margin-left: 5px; display: inline-block; padding: 2px 4px"> 新增明细条码:</span>
                                            <span> <el-input style="width: 200px" v-model="inhosbarcode" @keyup.enter.native="inhosmixedsampling" :disabled="txtinhosbarcodedisabled" autofocus ref="inhosbarcode"></el-input></span>
                                        </span>
                                    </div>
                                    <div style="font-size: 14px; padding-left: 3px; background-color: #fff; overflow: auto">
                                        <span>
                                            <span>
                                                <el-button @click="mixfinish()">混样完成</el-button>
                                            </span>
                                            <span>
                                                &nbsp;
                                            </span>
                                            <span>
                                                <el-button @click="mixbarcodecancel()">混样作废</el-button>
                                            </span>
                                            <span style="color: blue; font-weight: bold; margin-left: 13px; display: inline-block; padding: 2px 4px" @dblclick="queryhistorymixbarcode">混样条码:{{ mixprebarcode }}</span>
                                        </span>
                                    </div>
                                </template>
                            </vxe-table>
                        </template>
                    </rm-layout-right>
                    <vxe-table
                        v-else
                        :pager-config="tablePage"
                        show-overflow="tooltip"
                        :data="curTableData"
                        @cell-dblclick="curtable_celldblclick"
                        :cell-class-name="curtable_cellClassName"
                        :row-class-name="curtable_rowClassName"
                        :loading="curloading"
                        border
                        height="auto"
                        ref="tbCurSample"
                        resizable
                        size="mini"
                        stripe
                        :edit-config="{
                            trigger: 'click',
                            mode: 'cell',
                            showStatus: false,
                            activeMethod: ActiveMethod,
                            showIcon: false,
                        }"
                        :span-method="rowspanmethod"
                    >
                        <vxe-table-column :field="items.field" :title="items.title" :width="items.width" v-for="items in options.Cols" v-bind:key="items.field" align="center" header-align="center" :edit-render="items.field == 'sample_detail' ? { name: 'input', autoselect: true } : null" :formatter="items.field == 'emer_flag' ? formatterEmerFlag : items.field == 'consumabletype'? formatterConsumableType : null">
                            <template v-slot:edit="{ row }" v-if="items.field == 'sample_detail'">
                                <el-input v-model="row.sample_detail" style="width: 100%" placeholder=""> </el-input>
                            </template>
                            <template v-slot:header="{ column }" v-if="items.field == 'pat_name'">
                                <el-tooltip content="双击可以修改病人信息" placement="top-start">
                                    <span>病人信息</span>
                                </el-tooltip>
                            </template>
                            <template v-slot:header="{ column }" v-if="items.field == 'specimen_name'">
                                <el-tooltip content="双击可以修改标本类型" placement="top-start">
                                    <span>标本类型</span>
                                </el-tooltip>
                            </template>
                            <template v-slot:header="{ column }" v-else-if="items.field == 'strselect'">
                                <el-checkbox v-model="selectall" @change="chkselectall_change($event)"></el-checkbox>
                            </template>
                            <template v-slot:header="{ column }" v-else-if="items.field == 'emer_flag'">
                                <el-tooltip content="双击可以修改急诊标志" placement="top-start">
                                    <span>急</span>
                                </el-tooltip>
                            </template>
                            <template v-slot="{ row }" v-if="items.field == 'req_groupna'">
                                <div v-bind:style="{ background: row.req_groupcolor_b, color: row.req_groupcolor }">
                                    {{ row.req_groupna }}
                                </div>
                            </template>
                            <template v-slot="{ row }" v-else-if="items.field == 'req_barcode_head'">
                                <div v-bind:style="{ background: row.req_groupcolor_b, color: row.req_groupcolor }">
                                    {{ row.req_barcode_head }}
                                </div>
                            </template>
                            <template v-slot="{ row }" v-else-if="items.field == 'strselect'">
                                <el-checkbox v-model="row.bselect" v-if="row.strselect == '-1'" disabled="disabled" :key="0"></el-checkbox>
                                <el-checkbox v-model="row.bselect" v-else-if="row.strselect == '0'" :key="0" @change="chkselect_change($event, { row })"></el-checkbox>
                                <el-checkbox v-model="row.bselect" v-else @change="chkselect_change($event, { row })" checked="checked" :key="1"></el-checkbox>
                            </template>
                            <template v-slot="{ row }" v-else-if="items.field == 'item_price'">
                                <div v-if="options.barcodeisorignalno == '1' && options.cxorignalnobatchselect == '1' && options.mergedisplaybarcode == '1'">{{ row.displayprice }}</div>
                                <div v-else>{{ row.item_price }}</div>
                            </template>
                            <template v-slot="{ row }" v-else-if="items.field == 'qty'">
                                <div v-if="options.barcodeisorignalno == '1' && options.cxorignalnobatchselect == '1' && options.mergedisplaybarcode == '1'">{{ row.displayitemcnt }}</div>
                                <div v-else>{{ row.qty }}</div>
                            </template>
                            <template v-slot="{ row }" v-else-if="items.field == 'amount'">
                                <div v-if="options.barcodeisorignalno == '1' && options.cxorignalnobatchselect == '1' && options.mergedisplaybarcode == '1'">{{ row.displayamount }}</div>
                                <div v-else>{{ row.amount }}</div>
                            </template>
                        </vxe-table-column>
                        <template v-slot:fix>
                            <div style="font-size: 40px; padding-left: 3px; background-color: rgba(0, 0, 0, 0); overflow: auto; text-align: right">
                                <span style="font-weight: bold; margin-right: 18px; color: red">{{ barcnt }}</span>
                            </div>
                        </template>
                    </vxe-table>
                </el-tab-pane>
                <el-tab-pane style="height: 100%" v-if="options.showhistory" name="historytab">
                    <span slot="label" :class="{ redc: historycolor }"><i class="el-icon-time"></i>历史采样</span>
                    <rm-layout-right splitcolor="#F8F8FF" movingcolor="#e7e7ee" :splitwidth="5" :fixsize="345" :minfixsize="200">
                        <vxe-table :pager-config="tablePage" show-overflow="tooltip" :data="historyTableData" height="100%" @cell-click="history_cellclick" highlight-current-row :loading="historyloading" :cell-class-name="history_cellClassName" border ref="tbHistory" resizable size="mini" stripe>
                            <vxe-table-column field="create_dt" title="创建时间" width="100" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="pat_no" title="病人号" width="100" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="pat_name" title="姓名" width="75" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="req_groupna" title="分单类别" width="95" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="selectflag" title="全选" width="20" header-align="center" align="center">
                                <template v-slot:header="{ column }">
                                    <el-checkbox v-model="selectallhistory" @change="chkselectallhistory_change()"></el-checkbox>
                                </template>
                                <template v-slot="{ row }">
                                    <el-checkbox :disabled="row.req_stat == '9'" v-model="row.selectflag" @change="chkselecthistory_change($event, { row })"></el-checkbox>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="barcode" title="条码号" width="120" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="req_statname" title="状态" width="55" cellClassName header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="emer_flag" title="急" :formatter="formatterEmerFlag" width="25" header-align="center" align="center"> </vxe-table-column>
                            <vxe-table-column field="sample_items" title="申请项目(简称，部分)" width="190" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="amount" title="应收金额" width="55" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="req_deptname" title="申请科室" width="90" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="req_docname" title="申请医生" width="75" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="specimen_name" title="标本类型" width="75" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="pat_sexname" title="性别" width="30" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="pat_agestr" title="年龄" width="30" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="pat_phone" title="联系电话" width="85" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="create_username" title="创建人" width="75" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="print_dt" title="打印时间" width="100" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="print_username" title="打印人" width="75" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="print_count" title="打印次数" width="55" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="req_dt" title="申请时间" width="100" header-align="center" align="center"></vxe-table-column>
                            <vxe-table-column field="charge_dt" title="收费时间" width="100" header-align="center" align="center"></vxe-table-column>
                        </vxe-table>
                        <template v-slot:fix>
                            <rm-layout-top splitcolor="white" :splitwidth="5" :fixsize="200">
                                <div style="height: 100%">
                                    <vxe-table :data.sync="tableDatalog" :loading="loadinglog" :cell-class-name="ColumnClassName" height="100%" highlight-current-row highlight-hover-row resizable header-align="center" show-overflow="tooltip" show-header-overflow="tooltip" size="mini" border stripe ref="tablelog">
                                        <vxe-table-column field="log_date" title="操作日期" width="120px" align="center"></vxe-table-column>
                                        <vxe-table-column field="trans_type" title="操作类型" width="80px" align="center" :formatter="['formatSelectList', reqstatOptiontable]"></vxe-table-column>
                                        <vxe-table-column field="log_content" title="操作内容" width="220px" tree-node>
                                            <template v-slot="{ row }">
                                                <div style="max-width: 180px; display: inline-block">{{ row.log_content }}</div>
                                            </template>
                                        </vxe-table-column>
                                        <vxe-table-column field="username" title="操作者" width="100px" align="center"></vxe-table-column>
                                        <vxe-table-column field="ref_user" title="相关人" width="100px"></vxe-table-column>
                                        <vxe-table-column field="labgroupid" title="工作组" width="100px"></vxe-table-column>
                                        <vxe-table-column field="computer_name" title="操作时机器名" width="100px">
                                            <template v-slot="{ row }">
                                                <span style="color:blue;">{{row.computer_name}}</span>
                                                <i class="el-icon-refresh" @click="repalceComputerName(row)"></i>
                                            </template>
                                        </vxe-table-column>
                                        <vxe-table-column field="mac_address" title="操作时机器MAC" width="100px"></vxe-table-column>
                                        <vxe-table-column field="syncflag" title="同步HIS标志" width="100px"></vxe-table-column>
                                        <vxe-table-column field="synctime" title="同步时间" width="100px"></vxe-table-column>
                                        <vxe-table-column field="syncerrtext" title="同步失败信息" width="100px"></vxe-table-column>
                                    </vxe-table>
                                </div>
                                <template v-slot:fix>
                                    <vxe-table show-overflow="tooltip" :data="historyDetailTableData" border height="100%" ref="historyDetailTable" size="mini" show-header-overflow highlight-current-row resizable stripe>
                                        <vxe-table-column type="index" title="序号" width="30" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="req_itemname" title="项目名称" width="140" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="item_price" title="实际价格" width="55" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="qty" title="数量" width="30" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="req_itemcode" title="项目代码" width="85" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="his_itemcode" title="HIS项目代码" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="his_recordid" title="HIS记录号" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="combitemna" title="所属组合" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="base_price" title="基础价格" width="60" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="stat_flag" title="统计标记" width="80" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="other_flag" title="其他标记" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="status" title="状态" width="60" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="lab_add" title="实验室新增" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="add_dt" title="新增时间" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="add_user" title="新增人" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="req_groupid" title="分单类别" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="charge_flag" title="计价标志" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="his_refcol1" :title="options.his_refcol1name" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="his_refcol2" :title="options.his_refcol2name" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="his_refcol3" :title="options.his_refcol3name" width="100" header-align="center" align="center"></vxe-table-column>
                                        <vxe-table-column field="parent_itemcode" title="所属组合ID" width="100" header-align="center" align="center"></vxe-table-column>
                                    </vxe-table>
                                </template>
                            </rm-layout-top>
                        </template>
                    </rm-layout-right>
                </el-tab-pane>
                <el-tab-pane v-if="options.showpatlist" label="待采样病人列表" name="patlsttab">
                    <vxe-grid :columns="patlstcol" :pager-config="tablePage" :data="cxpatlistdata" @cell-dblclick="patlst_dblclick" header-align="center" :row-custom-style="patlist_rowClassName" :cell-class-name="patlist_cellClassName" :loading="patlistloading" :select-config="selectConfig" border height="auto" highlight-current-row highlight-hover-row ref="patlstxTable" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" stripe></vxe-grid>
                </el-tab-pane>
                <el-tab-pane v-if="options.showsampled" label="已采样病人" name="sampledtab">
                    <vxe-table :pager-config="tablePage" show-overflow="tooltip" :data="sampleddata" :loading="sampledloading" border height="auto" ref="sampledxTable" resizable size="mini" stripe>
                        <vxe-table-column field="create_dt" title="生成时间" sortable width="150" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_no" title="病人号" width="120" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_name" title="姓名" width="120" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_sexname" title="性别" width="60" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_agestr" title="年龄" width="60" header-align="center"></vxe-table-column>
                        <vxe-table-column field="items" title="项目描述" width="350" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_diag" title="临床诊断" width="120" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_phone" title="联系电话" width="120" header-align="center"></vxe-table-column>
                        <vxe-table-column field="pat_id" title="病人唯一号" width="120" header-align="center"></vxe-table-column>
                    </vxe-table>
                </el-tab-pane>
                <el-tab-pane :name="item.value" disabled="disabled" v-for="(item, index) in showReqgroupna" :key="index" :label="item.label" style="padding: 0px">
                    <div slot="label" :style="{ background: item.background, color: item.color }" :name="item.value">
                        {{ item.label }}
                    </div>
                </el-tab-pane>
            </el-tabs>
        </rm-layout-top>
        <template v-slot:fix>
            <div style="text-align: center">
                <span style="color: blue; font-size: 12px">{{ itemcnt }}</span
                >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red; font-size: 12px; width: 100px">{{ barcnt }}</span
                >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;font-size:12px;margin-left: :100px;">{{ sumamount }}</span>
            </div>
        </template>
        <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择标本类型" :visible.sync="popSpecVisible">
            <rm-pop-common @change="popSpec_change" @cancel="popSpecVisible = false" datatype="specimen" dataname="标本类型"></rm-pop-common>
        </el-dialog>

        <el-dialog width="1100px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="预制条码存盘前确认" :visible.sync="popBarCodeCheckVisible">
            <table class="table1style">
                <tr style="height: 30px; vertical-align: middle">
                    <td>条码扫描区域</td>
                    <td>
                        <el-input :class="{ csstxtbarsacn: check_isErr }" ref="check_txtbarsacn" @focus="check_barscanfocus" v-model="check_barmsg" @keyup.enter.native="check_barsacn()" style="width: 200px"></el-input>
                    </td>
                </tr>
            </table>
            <vxe-table :data="CheckBarCodeList" ref="xTableCheckBarCode" height="400px" show-overflow border size="mini" show-header-overflow resizable :row-class-name="check_rowClassName">
                <vxe-table-column field="pat_no" title="病人号" width="80" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="pat_name" title="病人姓名" width="80" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="pat_sexname" title="性别" width="60" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="pat_agestr" title="年龄" width="80" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="req_groupna" title="分单类别" width="120" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="specimen_name" title="标本类型" width="120" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="req_barcode_head" title="前缀" width="50" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="req_barcode_length" title="长度" width="50" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="barcode" title="条码号" width="110" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="check_barcode" title="确认条码号" width="110" header-align="center" align="center"></vxe-table-column>
                <vxe-table-column field="reqdisplayname" title="申请项目名称" width="200" header-align="center" align="center"></vxe-table-column>
            </vxe-table>
        </el-dialog>

        <el-dialog width="500px" top="2px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="病人信息补输入" :visible.sync="popPatInfovisible">
            <table style="width: 90%; margin-left: 20px; font-size: 12px; border-collapse: separate; border-spacing: 5px">
                <tr>
                    <td style="text-align: right; padding-right: 10px">姓名</td>
                    <td style="text-align: right" colspan="4">
                        <el-input v-model="update_pat_name"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px">英文姓名</td>
                    <td style="text-align: right" colspan="4">
                        <el-input v-model="update_pat_nameen"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px; width: 90px">性别</td>
                    <td tyle="text-align: right; width: 100px">
                        <el-select v-model="update_pat_sex" clearable style="width: 100%">
                            <el-option key="1" value="1" label="男">男</el-option>
                            <el-option key="2" value="2" label="女">女</el-option>
                            <el-option key="3" value="3" label="未知">未知</el-option>
                        </el-select>
                    </td>
                    <td style="text-align: right; width: 50px">电话</td>
                    <td tyle="text-align: right; " colspan="2">
                        <el-input v-model="update_pat_phone"></el-input>
                    </td>
                    <!-- <td style="text-align: right; width: 50px">年龄</td>
                    <td style="text-align: right; width: 100px">
                        <el-input v-model="update_pat_agestr"></el-input>
                    </td>
                    <td style="text-align: left; width: 80px">
                        <el-select v-model="update_pat_unit" clearable style="width: 100%">
                            <el-option key="1" value="1" label="岁">岁</el-option>
                            <el-option key="2" value="2" label="月">月</el-option>
                            <el-option key="3" value="3" label="天">天</el-option>
                            <el-option key="4" value="4" label="小时">小时</el-option>
                            <el-option key="5" value="5" label="分钟">分钟</el-option>
                        </el-select>
                    </td> -->
                </tr>
                <!-- <tr style="height: 30px">
                    <td style="text-align: right; padding-right: 10px">电话</td>
                    <td tyle="text-align: right; " colspan="4">
                        <el-input v-model="update_pat_phone"></el-input>
                    </td>
                </tr> -->
                <tr>
                    <td style="text-align: right; padding-right: 10px">地址</td>
                    <td tyle="text-align: right; " colspan="4">
                        <el-input v-model="update_pat_address"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px">身份证号</td>
                    <td tyle="text-align: right; " colspan="4">
                        <el-input v-model="update_pat_idcardno"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px">{{ this.options.patothno1alias }}</td>
                    <td tyle="text-align: right; " colspan="4">
                        <el-input v-model="update_pat_othno1"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px">{{ this.options.patothno2alias }}</td>
                    <td tyle="text-align: right; " colspan="4">
                        <el-input v-model="update_pat_othno2"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px">{{ this.options.patothno3alias }}</td>
                    <td tyle="text-align: right; " colspan="4">
                        <el-input v-model="update_pat_othno3"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 10px; vertical-align: top">医生备注</td>
                    <td style="text-align: right" colspan="4">
                        <el-input v-model="update_req_comm" type="textarea" :rows="3"></el-input>
                    </td>
                </tr>

                <tr>
                    <td colspan="5" style="text-align: center">
                        <el-button style="margin: 0px 10px 0px 5px" @click="PatinfoSave">确定</el-button>
                        <el-button style="margin: 0px 10px 0px 5px" @click="PatinfoCancel">取消</el-button>
                    </td>
                </tr>
            </table>
            <!-- <span slot="footer" class="dialog-footer">
                <el-button style="margin: 0px 10px 0px 5px" @click="CalculateSave()">确定</el-button>
                <el-button style="margin: 0px 10px 0px 5px" @click="(Valuedialogvisible = false), (tempqcdata = {})">取消</el-button>
            </span> -->
        </el-dialog>

        <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择标本备注说明" :visible.sync="popsampledetailvisible">
            <rm-pop-common @change="popsam_detailchange" @cancel="popsampledetailvisible = false" datatype="seccode" kindno="SAMPLE_DETAIL" dataname="标本备注说明"></rm-pop-common>
        </el-dialog>

        <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请输入附加报告项目结果" :visible.sync="addRptItemVisible" width="500px" min-height="300px">
            <vxe-table show-overflow="tooltip" :data="AddaRptItemList" border height="auto" ref="AddaRptItemTable" resizable size="mini" stripe :edit-config="{ trigger: 'click', mode: 'cell' }">
                <vxe-table-column field="rpt_itemname" title="项目名称" width="200" header-align="center"></vxe-table-column>
                <vxe-table-column field="value" title="项目结果" width="120" header-align="center" :edit-render="{ name: 'input' }"></vxe-table-column>
                <vxe-table-column field="unit" title="单位" width="60" header-align="center"></vxe-table-column>
            </vxe-table>
            <span slot="footer" class="dialog-footer">
                <el-button @click="CommitTips()">确 定</el-button>
                <el-button @click="CancelTips()">取 消</el-button>
            </span>
        </el-dialog>

        <el-dialog width="650px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="混样条码记录查询" :visible.sync="dialogquerymixVisible">
            <template>
                <div style="width: 100%; position: relative">
                    <table style="font-size: 12px; white-space: nowrap; max-width: 1170px">
                        <tr>
                            <td style="color: blue">请输入要追加混样的试管条码号：</td>
                            <td>
                                <el-input v-model="querymixbarcode" style="width: 300px" ref="querybarcode" @keyup.enter.native="btnmixqueryok()"></el-input>
                            </td>
                            <td style="width: 300px; text-align: right">
                                <el-button @click="btnmixqueryok()" icon="el-icon-search">确认</el-button>
                                <el-button @click="btnmixquerycancel()" icon="el-icon-printer">取消</el-button>
                            </td>
                        </tr>
                    </table>
                </div>
            </template>
        </el-dialog>
        <el-dialog width=" 650px" height="150px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="提示" :visible.sync="dialogdeleteVisible">
            <template>
                <div style="width: 100%; position: relative">
                    <table style="font-size: 12px; white-space: nowrap; max-width: 1170px; height: 110px">
                        <tr>
                            <td style="color: blue; font-size: 16px">是否要从混样信息中删除【{{ this.deletename }}】?</td>
                        </tr>
                        <tr>
                            <td style="width: 650px; text-align: right">
                                <el-button style="width: 100px; font-size: 13px" @click="btnmixdeletecancel()">删&nbsp;&nbsp;&nbsp;&nbsp;除</el-button>
                                <el-button style="width: 100px; font-size: 13px" @click="btnmixdeleteok()">删除并作废条码</el-button>
                                <el-button style="width: 100px; font-size: 13px" @click="btnmixcancel()">取&nbsp;&nbsp;&nbsp;&nbsp;消</el-button>
                            </td>
                        </tr>
                    </table>
                </div>
            </template>
        </el-dialog>
        <!-- 混采预制条码弹窗 -->
        <el-dialog title="扫描混样试管码" :visible.sync="dialogpremixbarcode" width="480px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" ref="refdialogpremixbarcode" :before-close="BeforeCloseDialogpremixbarcode" @closed="dialogpremixbarcodeClosed" @opened="opendialogpremixbar">
            <div style="height: 40px; padding-top: 10px">条码前缀：{{ premixheader }} 条码长度：{{ premixlen }}</div>
            <div style="height: 40px">
                <el-input v-model="premixprebarcode" style="width: 460px" ref="refpremixbar" @keyup.enter.native="premixbarsacn()"></el-input>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="premixbarsacn">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 重复项目提示弹窗 -->
        <el-dialog title="提示" :visible.sync="dialogShowTips" width="450px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false">
            <div>
                <h4>提取的医嘱中：</h4>
                <h4>{{samespecimenOps}}</h4>
                <h4>这些申请项目存在重复</h4>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogShowTips=false">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 提示用户输入病人身份证和电话弹窗 -->
        <el-dialog title="提示" :visible.sync="dialogShowInputPatinfo" width="500px" :show-close="false" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false">
            <div style="height: 100%; padding: 5px"><span style="font-size: 15px; color: red;">请确认以下信息是否正确，若不正确请修改为正确信息，并点击确定</span></div>
            <table style="width: 100%">
                <tr>
                    <td style="width: 80px;">
                        姓名
                    </td>
                    <td colspan="3">
                        <el-input v-model="plug_name" style="width: 380px"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px">
                        性别
                    </td>
                    <td>
                        <el-select v-model="plug_sexname" style="width: 145px">
                            <el-option key="男" value="男" label="男">男</el-option>
                            <el-option key="女" value="女" label="女">女</el-option>
                        </el-select>
                    </td>
                    <td style="width: 60px">
                        年龄
                    </td>
                    <td>
                        <el-input v-model="plug_age" style="width: 150px"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px">
                        <span style="color: red;">身份证号</span>
                    </td>
                    <td colspan="3">
                        <el-input v-model="plug_idcardno" style="width: 380px"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px">
                        地址
                    </td>
                    <td colspan="3">
                        <el-input v-model="plug_address" style="width: 380px"></el-input>
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px">
                        <span style="color: red;">电话号码</span>
                    </td>
                    <td colspan="3">
                        <el-input v-model="plug_phonenum" style="width: 380px"></el-input>
                    </td>
                </tr>
            </table>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogShowInputPatinfo=false">取  消</el-button>
                <el-button type="primary" @click="plugConfirmClick">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 修改条码号弹窗 -->
        <el-dialog title="提示" :visible.sync="dialogShowChangeBarcode" width="450px" :show-close="false" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false">
            <div style="height: 100%; padding-top: 5px"><span style="font-size: 20px; color: red;">您需要对条码：{{ dbclick_barcode }}  做以下哪种修改？</span></div>
            <table style="width: 100%; padding-top: 15px;padding-bottom: 15px;">
                <tr>
                    <td style="width: 80px;">
                        扫描条码
                    </td>
                    <td style="width: 355px;">
                        <el-input v-model="dbclick_newbarcode" @keyup.enter.native="changeBarcodeClick()" style="width: 310px" ref="dbclick_scanbarcode"></el-input>
                    </td>
                </tr>
            </table>
            <span slot="footer" class="dialog-footer">
                <el-button @click="cancleBarcodeClick">取 消</el-button>
                <el-button type="primary" @click="clearBarcodeClick">清  除</el-button>
                <el-button type="primary" @click="changeBarcodeClick">替  换</el-button>
            </span>
        </el-dialog>
        <!-- 排队叫号弹窗 -->
        <rm-floatwindow v-rm-drag-window :visible="showcallwindow" winStyle="top:40px;left:80%;width:200px;height:295px;" title="瑞美软件叫号" :showClose=false>
            <div style="width:100%;height:60%; text-align:center;">
                <div style="margin:3px;">
                    <el-button size="large" style="width:150px; margin-top:10px; margin-bottom:10px; text-align:center;" @click="callnextone">呼叫下一个(F9)</el-button>
                </div>
                <div style="margin:3px;">
                    <el-button size="large" style="width:150px; margin-bottom:10px; text-align:center;" @click="recall">重新呼叫(F10)</el-button>
                </div>
                <!-- <div style="margin:3px;">
                    <el-button style="width:150px; text-align:center;" @click="passcall">过号(F11)</el-button>
                </div> -->
                <div style="margin:3px;">
                    <el-button size="large" style="width:150px; text-align:center;" @click="stopcall">暂停服务</el-button>
                </div>
            </div>
            <div style="width:100%;height:35%;">
                <div style="text-align:left; margin-left:5px; width: calc(100%-5px);">当前病人排队号：{{call_queueseq}}</div>
                <div style="text-align:left; margin-left:5px; width: calc(100%-5px);">当前病人姓名：{{call_patname}}</div>
                <div style="text-align:left; margin-left:5px; width: calc(100%-5px);">当前病人号：{{call_patno}}</div>
                <div style="text-align:left; margin-left:5px; width: calc(100%-5px);">当前状态：</div>
                <div style="text-align:left; margin-left:5px; width: calc(100%-5px);">已呼叫：{{havecallcount}}  人</div>
                <div style="text-align:left; margin-left:5px; width: calc(100%-5px);">正在等待：{{waitcallcount}} 人</div>
            </div>
        </rm-floatwindow>

        <rm-floatwindow v-rm-drag-window :visible="dialogAdvicefloatwindowVisible" :isMarrow="true" :winStyle="floatwindowstyle3" title="患者照片" @close="FloatClose($event, '2')">
            <div style="margin: 5px 5px 10px 5px; width: 100%; height: 100%">
                <el-image :src="image" fit="fill"></el-image>
            </div>
        </rm-floatwindow>

        <!-- 修改标本类型弹窗 -->
        <el-dialog title="提示" :visible.sync="showModifySpecimen" width="650px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false">
            <div>
                <div :key="group.groupName" v-for="group in modifySpecimenObj">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                <div><span style="font-size: 15px; color: red;">{{group.groupName}}</span> 有多个标本种类，统一修改标本种类为：</div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <el-radio-group v-model="group.value" :key="block.Item5" v-for="block in group.subList" text-align="left">
                                    <el-radio :label="block.Item3" style="margin-right:15px;">{{block.Item4}}</el-radio>
                                </el-radio-group>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="modifySpecimenFun">确 定</el-button>
                <el-button @click="showModifySpecimen=false">取  消</el-button>
            </span>
        </el-dialog>

        <!-- 信息提示弹窗 -->
        <el-dialog title="提示" :visible.sync="showMsgTip" width="650px" :show-close="false" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false">
            <div>
                <div v-if="tipmsgFlag == '1'">
                    <div class="msgTipTitle">
                        <span class="msgTipSpan"><i class="el-icon-chat-dot-round"></i> 医嘱信息</span>
                    </div>
                    <div class="msgTipWords" :title="tipmsg">
                        {{ tipmsg }}
                    </div>
                </div>
                <div v-if="samespecimenFlag == '1'">
                    <div class="msgTipTitle">
                        <span class="msgTipSpan"><i class="el-icon-document-copy"></i> 重复申请项目</span>
                    </div>
                    <div class="msgTipWords" :title="samespecimenMsg">
                        {{ samespecimenMsg }}
                    </div>
                </div>
                <div v-if="nottodayitemsFlag == '1'">
                    <div class="msgTipTitle">
                        <span class="msgTipSpan"><i class="el-icon-date"></i> 非当天申请项目</span>
                    </div>
                    <div class="msgTipWords" :title="nottodayitemsMsg">
                        {{nottodayitemsMsg}}
                    </div>
                </div>
                <div v-if="msgTipContentFlag == '1'">
                    <div class="msgTipTitle">
                        <span class="msgTipSpan"><i class="el-icon-money"></i> 不相同字段申请项目</span>
                    </div>
                    <div class="msgTipWords" :title="msgTipContent">
                        {{msgTipContent}}
                    </div>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="closeShowMsgTip">确 定</el-button>
            </span>
        </el-dialog>

    </rm-layout-bottom>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
import XE from "xe-utils"; //引入工具类
XE.mixin({
    // 自定义全局的格式化处理函数
    formatSelectList(cellValue, list) {
        let item = list.find((item) => item.data == cellValue);
        return item ? item.display : "";
    },
});
export default {
    name: "REQ110",
    data() {
        return {
            copystr: "",
            showReqgroupna: [],
            itemcnt: "0项",
            barcnt: "0个条码",
            sumamount: "合计：0.00",
            sumam: 0,
            inputno: "",
            barmsg: "",
            check_barmsg: "",
            activeName: "curtab",
            floatwindowstyle3: "top:5px;left:calc(20% + 40px );width:250px;height:350px", //患者照片浮动窗口回传样式
            dialogAdvicefloatwindowVisible: false, //患者照片浮动窗口显示标志
            image: "",
            IsPrintBarcode: false,
            bUsrDefineQdate: false,
            bShowRepeatItem: false,
            bPrintBackBill: false,
            bNameEncrypt: false,
            datedisabled: true,
            cancelbtndisabled: true,
            camerabtndisabled: true,
            isErr: true,
            check_isErr: true,
            addRptItemVisible: false,
            patname: "",
            querydate1: "",
            querydate2: "",
            pickerOptions: {
                shortcuts: [
                    {
                        text: "今天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "三天前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 2);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "一周前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "两周前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 13);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "一个月前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 29);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "两个月前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 59);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "三个月前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 89);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "一年前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "两年前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 730);
                            picker.$emit("pick", start);
                        },
                    },
                    {
                        text: "五年前",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 1825);
                            picker.$emit("pick", start);
                        },
                    },
                ],
            },
            startdt: "",
            enddt: "",
            overmoney: "",
            sampledcnt: "0",
            personcnt: "0",
            sampledcntdispay: false,
            overmoneydispay: false,
            barscandispay: false,
            historycss: "redc",
            tablePage: {
                pageSize: 1000,
            },
            curTableData: null,
            curloading: false,
            historyTableData: null,
            historyloading: false,
            popSpecVisible: false,
            popBarCodeCheckVisible: false,
            popMsgVisible: false,
            popPatInfovisible: false,
            popsampledetailvisible: false,
            clickrow: null,
            refhistory: false,
            popPatAgeInputVisible: false,
            poppatinfo: {},
            ddlageunit: "岁",
            ageunits: [{ value: "岁" }, { value: "月" }, { value: "天" }, { value: "时" }, { value: "分" }],
            txtinputnodisabled: false,
            txtinhosbarcodedisabled:false,
            barscandisabled: true,
            selectall: true,
            selectallhistory: false,
            reprtbtndisabled: true,
            prtbtndisabled: true,
            cxorignalnobatchselect: false,
            barcodestr: "",
            noorders: false,
            selectConfig: {
                tigger: "row",
            },
            endflag: false,
            patlstcol: [],
            cxpatlistdata: [],
            patlistloading: false,
            sampleddata: [],
            sampledloading: false,
            historycolor: false, //"black" //909399
            cbarno: "",
            setOnlybar: "",
            AddaRptItemList: [],
            CheckBarCodeList: [],
            options: {}, //此处要优化 所有设置都放在这里
            mix_itemcode: "", //需混采的项目，传入后台比较使用
            mixTableData: [], //
            historyDetailTableData: [], //历史明细表数据
            tableDatalog:[],
            historyBarcode: "",
            mixloading: false,
            mixprebarcode: "", // 预置混样条码
            premixprebarcode: "", // 预置条码模式下混样条码
            premixheader: "", //混样预制条码前缀
            premixlen: "", //混样预制条码长度
            dialogpremixbarcode: false,
            mix_cnt: "0", // 已混数量
            mix_barcode: "", // 需要混采的条码号
            querymixbarcode: "", // 查询使用
            dialogquerymixVisible: false,
            dialogdeleteVisible: false,
            deleterow: "",
            deletename: "",
            update_pat_name: "",
            update_pat_nameen: "",
            update_pat_sex: "",
            update_pat_agestr: "",
            update_pat_phone: "",
            update_pat_address: "",
            update_pat_idcardno: "",
            update_req_comm: "",
            update_pat_othno1: "",
            update_pat_othno2: "",
            update_pat_othno3: "",
            update_pat_unit: "",
            ischange: "0",
            oldagestr: "",
            inhosbarcode: "",
            currentpatname: "",
            chk_fixeddate: "",
            fixeddateOption: [],
            dialogShowTips: false,
            samespecimenOps:"",
            enterMode: 0,
            tempBarcode:'',
            reqstatOptiontable: [],
            loadinglog: false,
            showcallwindow: false,
            havecallcount: "0",
            waitcallcount: "0",
            isStopCall: "0",
            call_patno: "",
            call_patname: "",
            call_queueseq: "",
            showModifySpecimen: false,
            modifySpecimenObj: [],
            modifyspecimenData: [],
            dialogShowInputPatinfo: false,
            dialogShowChangeBarcode: false,
            plug_idcardno: "",
            plug_phonenum: "",
            plug_name: "",
            plug_sexname: "",
            plug_age: "",
            plug_address: "",
            flag_isShowInputPatinfo: "",
            flag_isShowInputPatinfo_item: "",
            curr_checkrowinfo: [],
            dbclick_barcode: "",
            dbclick_newbarcode: "",
            showMsgTip: false,
            tipmsgFlag: '0',
            tipmsg: "",
            samespecimenFlag: '0',
            samespecimenMsg: "",
            nottodayitemsFlag: '0',
            nottodayitemsMsg: "",
            msgTipContentFlag: '0',
            msgTipContent: "",
        };
    },
    created() {
        this.InitPageDate();
        this.getcxorignalnobatchselect();
        let otherparam = JSON.parse(this.$tool.getSession(this.$tool.otherparam));
        // console.log("otherparam", otherparam);
        if (otherparam && otherparam.c == "2") {
            if (otherparam.p1 && otherparam.p1 != "") {
                this.inputno = otherparam.p1;
                this.txtinputno_enter();
            }
            this.$tool.removeSession(this.$tool.otherparam);
        }
        this.$bus.$on("browsermsg", (p) => {
            if (p) {
                this.$router.push("/refresh/1");
                // if (p.p1 && p.p1 != "") {
                //     this.inputno = p.p1;
                //     this.txtinputno_enter();
                // }
            }
        });
    },
    activated() {
        if (this.$refs.txtinputno) {
            this.$refs.txtinputno.focus();
        }
    },
    mounted() {
        if (this.$refs.txtinputno) {
            this.$refs.txtinputno.focus();
        }
        this.sampledcnt = "100000";
        this.$bus.$on("imagecatch", (imgbase64) => {
            this.imagecatch(imgbase64);
        });
        //获取本地cookie
        this.chk_fixeddate = "0";
        this.fixeddateOption = [];
        let fixdate_Arr = localStorage.getItem("rm_FixDate_REQ110");
        let fixdate_Obj = JSON.parse(fixdate_Arr);
        if (fixdate_Obj != null) {
            this.fixeddateOption = XEUtils.clone(fixdate_Obj, true);
            this.chk_fixeddate = this.fixeddateOption.chk_fixeddate;
            var startdate = XEUtils.toDateString(this.fixeddateOption.sdate, "yyyy-MM-dd");
            var enddate = XEUtils.toDateString(this.fixeddateOption.edate, "yyyy-MM-dd");
            var currdate = XEUtils.toDateString(new Date(), "yyyy-MM-dd");
            if (enddate != currdate) {
                var diffdate = Math.floor((new Date(enddate).getTime() - new Date(startdate).getTime()) / (24 * 3600 * 1000));
                this.querydate2 = currdate;
                var currdate_tmp = new Date(currdate);
                currdate_tmp = currdate_tmp.setDate(currdate_tmp.getDate() - diffdate);
                currdate_tmp = new Date(currdate_tmp);
                var sday_temp = this.dateFormat(currdate_tmp);
                this.querydate1 = XEUtils.toDateString(sday_temp, "yyyy-MM-dd");
            } else {
                this.querydate1 = startdate;
                this.querydate2 = enddate;
            }
        }
    },
    updated() {},
    methods: {
        FloatClose(style, type) {
            this.dialogAdvicefloatwindowVisible = false;
            this.floatwindowstyle3 = style.cssText;
            localStorage.setItem("floatwindowstyle3", this.floatwindowstyle3);
        },
        readcard() {
            var s = this.$pub.readcardjson(this,this.options.readcardcmdline);
            if (!s) {
                this.$message.error("读卡失败");
            }
            else {
                console.log(s);
                //返回卡号
                this.inputno = s;
                this.txtinputno_enter();
            }
        },
        fixeddateChange() {
            if (this.chk_fixeddate == "1") {
                var querydate1_tmp = new Date(this.querydate1);
                var querydate2_tmp = new Date(this.querydate2);
                let jsondate = {
                    chk_fixeddate: this.chk_fixeddate,
                    sdate: XEUtils.toDateString(querydate1_tmp, "yyyy-MM-dd"),
                    edate: XEUtils.toDateString(querydate2_tmp, "yyyy-MM-dd"),
                };
                let fixeddateJson = JSON.stringify(jsondate);
                localStorage.setItem("rm_FixDate_REQ110", fixeddateJson);
            } else {
                localStorage.removeItem("rm_FixDate_REQ110");
            }
        },
        dateFormat(dateData) {
            var date = new Date(dateData);
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            m = m < 10 ? "0" + m : m;
            var d = date.getDate();
            d = d < 10 ? "0" + d : d;
            const time = y + "-" + m + "-" + d;
            return time;
        },
        querycxpatlist() {
            this.activeName = "patlsttab";
            this.patlistloading = true;
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "querycxpatlist",
                        begdt: this.querydate1,
                        enddt: this.querydate2,
                        patname: this.patname,
                    },
                })
                .then((res) => {
                    this.patlistloading = false;
                    if (res.flag == "-1"){
                        this.$alert(res.msg, "提示", {
                            confirmButtonText: "确定",
                        });
                    }
                    else {
                        this.patlstcol = res.RData.Cols;
                        this.cxpatlistdata = res.RData.Data;
                    }
                })
                .catch((e) => {});
        },
        callnextone(){
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "callnextone",
                    },
                })
                .then((res) => {
                    if (res.flag == 1) {
                        this.$message.success("叫号成功！");
                        this.isStopCall="0";
                        //定时获取当前呼叫病人号，病人姓名，已呼叫数量
                        setTimeout(() => {
                            this.getqueuepatinfo();
                        }, 2000);
                        // if(this.options.localplayqueuevoice == "1"){
                        //     //调用语音，播放排队号
                        //     this.speakMessage(res.msg);
                        // }
                    } else if (res.flag == 2) {
                        this.$alert(res.msg, "提示", {
                            confirmButtonText: "确定",
                        });
                    }
                    else {
                        this.$alert(res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {
                    consoel.log(e);
                });
        },
        recall(){
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "recall",
                    },
                })
                .then((res) => {
                    if (res.flag == 1) {
                        this.$message.success("重呼成功！");
                        // if(this.options.localplayqueuevoice == "1"){
                        //     //调用语音，播放排队号
                        //     this.speakMessage(res.msg);
                        // }
                    } else {
                        this.$alert(res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {
                    consoel.log(e);
                });
        },
        passcall(){
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "passcall",
                    },
                })
                .then((res) => {
                    if (res.flag == 1) {
                        this.$message.success("过号成功！");
                    } else {
                        this.$alert(res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {
                    consoel.log(e);
                });
        },
        stopcall(){
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "stopcall",
                    },
                })
                .then((res) => {
                    if (res.flag == 1) {
                        this.$message.success("暂停服务成功！");
                        this.isStopCall="1";
                        this.call_patno="暂停服务";
                        this.call_patname="";
                    } else {
                        this.$alert(res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {
                    consoel.log(e);
                });
        },
        getqueuepatinfo(){
            if(this.isStopCall=="1") {
                return false;
            }
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "getqueuepatinfo",
                    },
                })
                .then((res) => {
                    let t = 3000; //延时3秒获取一次
                    if (res.flag == 1) {
                        //与当前不同，赋值
                        if(res.call_patno != this.call_patno){
                            this.call_queueseq = res.queueseqdisplay
                            this.call_patno = res.call_patno;
                            this.call_patname = res.call_patname;
                            this.havecallcount = res.havecallcount;
                        }
                        else{
                            //与当前相同，定时再获取
                            setTimeout(() => {
                                this.getqueuepatinfo();
                            }, t);
                        }
                    } else {
                        setTimeout(() => {
                            this.getqueuepatinfo();
                        }, t);
                    }
                })
                .catch((e) => {
                    consoel.log(e);
                });
        },
        //消息声音提示
        speakMessage(message) {
            //语音播报
            console.log(" speekstr :", message);
            if (typeof jsObj != "undefined") {
                jsObj.Speek(message);
            } else {
                var u = new SpeechSynthesisUtterance();
                u.text = message;
                u.lang = "zh";
                u.rate = 0.7;
                speechSynthesis.speak(u);
            }
        },
        getwaitnum(){
            return new Promise((s, f) => {
                this.$tool
                    .request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "getwaitnumcount",
                        },
                    })
                    .then((res) => {
                        this.waitcallcount = res.waitnumcountcount;
                        let t = 60000; //1分钟获取一次
                        setTimeout(() => {
                            this.getwaitnum();
                        }, t);
                    })
                    .catch((e) => {
                        setTimeout(() => {
                            this.getwaitnum();
                        }, 15000);
                    });
            });
        },
        addqueue() {
            if (!this.patname) {
                this.$alert("请先输入姓名！");
                this.txtpatname.focus();
                return;
            }
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "addqueue",
                        patname: this.patname,
                    },
                })
                .then((res) => {
                    console.log("res", res);
                    if (res.flag == 1) {
                        if (typeof jsObj != "undefined") {
                            // 打印
                            let str = res.colstr;
                            str += "\r";
                            str += res.printstr;
                            let sql = btoa(encodeURIComponent(str));
                            jsObj.PrintCustomJsonReport(res.styleid, sql, this.$tool.getSession(this.$tool.loginusername), "report", "");
                        } else {
                            this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                                confirmButtonText: "确定",
                            });
                        }
                    } else {
                        this.$alert(res.errmsg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {});
        },
        patlst_dblclick({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }) {
            this.inputno = row.pat_no;
            this.currentpatname = row.pat_name;
            this.enterMode = 0;
            this.txtinputno_enter();
        },
        patlist_cellClassName({ seq, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) {
            if (column.property == "pat_name") {
                return "rm-blue1";
            }
        },
        patlist_rowClassName({ row, rowIndex }) {
            if (row.rbcolor) {
                if (row.rbcolor.startsWith("CSS:")) {
                    return row.rbcolor.substring(4);
                } else {
                    return "background-color:" + row.rbcolor + ";";
                }
            }
        },
        getcxorignalnobatchselect() {
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "getcxorignalnobatchselect",
                    },
                })
                .then((res) => {
                    this.cxorignalnobatchselect = res;
                })
                .catch((e) => {});
        },
        curtable_cellClassName({ seq, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) {
            if (column.property == "emer_flag") {
                if (row.emer_flag == "1") {
                    return "rm-alert";
                }
            } else if (column.property == "reqdisplaycomm") {
                if (!!row.reqdisplaycomm) {
                    return "rm-alert";
                }
            }
            // else if (column.property == "req_comm" || column.property == "reqdisplaycomm") {
            //     if (!!row.req_comm || !!row.reqdisplaycomm) {
            //         return "rm-alert";
            //     }
            // }
            else if (column.property == "req_groupna") {
                return "req110top";
                //return "rm-nopadding ";
            }
        },
        curtable_rowClassName({ row, rowIndex }) {
            if (row.is_used || row.isShow == "1") {
                return "rm-hid";
            } else if (row.bselect == false) {
                return "rm-unselect";
            } else if (row.endflag == "1") {
                return "rm-end";
            }
        },
        history_cellClassName({ row, rowIndex, column, columnIndex }) {
            if (column.property == "req_statname") {
                return this.$pub.getreqstatclass(row.req_stat);
            }
        },
        history_cellclick({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }, event) {
            if (row.req_stat != "9") {
                if (event.target.tagName == "DIV") {
                    if (column.property == "selectflag") {
                        if (row.req_stat >= "4" && this.options.noprintbarcodercv == "1" && row.req_stat != "8") {
                            this.$message.warning("已接收标本禁止重打条码！");
                        } else row.selectflag = !row.selectflag;
                    }
                }
            }
            this.HistoryCurrentChange(row.barcode);
            this.QueryLog(row.barcode);
        },
        HistoryCurrentChange(barcode) {
            if (barcode) {
                if (this.historyBarcode != barcode) {
                    //加载详情
                    this.$tool
                        .request({
                            url: "REQ/REQ1/REQ110",
                            method: "post",
                            data: {
                                action: "gethistorydetail",
                                barcode: barcode,
                            },
                        })
                        .then((res) => {
                            this.historyDetailTableData = res.RData.Data;
                            this.historyBarcode = barcode;
                        })
                        .catch((e) => {
                            console.log("error", e);
                        });
                }
            } else {
                return;
            }
        },
        QueryLog(barcode) {
            this.loadinglog = true;
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "querylog",
                        barcode: barcode,
                    },
                })
                .then((res) => {
                    this.tableDatalog = this.DealLog(res);
                    this.loadinglog = false;
                })
                .catch((err) => {
                    this.loadinglog = false;
                });
        },
        DealLog(res) {
            var data = res.Data.Data;
            var rptlogdt = res.reportlogdt;
            var bactlogdt = res.bactlogdt;
            var redata = [];
            for (let i = 0; i < data.length; i++) {
                if (data[i].reportid) {
                    var children = rptlogdt.filter((item) => item.reportid == data[i].reportid);
                    if (children.length > 0) data[i].children = children;
                }
                if(data[i].sampleid && data[i].trans_type=='-43'){
                    if(bactlogdt && bactlogdt.length>0){
                        data[i].children = bactlogdt;
                    }
                }
                redata.push(data[i]);
            }
            return redata;
        },
        curtable_celldblclick({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }, event) {
            if (column.property == "reqdisplaycomm") {
                var obj = document.getElementById("copydiv");
                obj.value = row.reqdisplaycomm;
                obj.focus();
                obj.select();
                if (document.execCommand("copy", false, null)) {
                    this.$message.success("复制剪切板成功！");
                } else {
                    this.$message.error("复制失败，请检查浏览器是否支持复制操作！");
                }
            }

            if (row.strselect == -1) {
                return;
            }
            if (column.property == "emer_flag") {
                if (row.emer_flag == "1") {
                    row.emer_flag = "0";
                } else {
                    row.emer_flag = "1";
                }
            } else if (column.property == "specimen_name") {
                this.clickrow = row;
                this.popSpecVisible = true;
            } else if (column.property == "sample_detail") {
                this.clickrow = row;
                this.popsampledetailvisible = true;
            } else if (column.property == "pat_name") {
                this.clickrow = row;
                this.update_pat_name = row.pat_name;
                this.update_pat_nameen = row.pat_nameen;
                this.update_pat_sex = row.pat_sex;
                //this.update_pat_agestr = row.pat_agestr;
                this.update_pat_phone = row.pat_phone;
                this.update_pat_address = row.pat_address;
                this.update_pat_idcardno = row.pat_idcardno;
                this.update_req_comm = row.req_comm;
                this.update_pat_othno1 = row.pat_othno1;
                this.update_pat_othno2 = row.pat_othno2;
                this.update_pat_othno3 = row.pat_othno3;
                this.oldagestr = row.pat_agestr;
                // if (row.pat_agestr.indexOf("岁") > -1) {
                //     this.update_pat_unit = "1";
                //     this.update_pat_agestr = row.pat_agestr.replace("岁", "");
                // } else if (row.pat_agestr.indexOf("月") > -1) {
                //     this.update_pat_unit = "2";
                //     this.update_pat_agestr = row.pat_agestr.replace("月", "");
                // } else if (row.pat_agestr.indexOf("天") > -1) {
                //     this.update_pat_unit = "3";
                //     this.update_pat_agestr = row.pat_agestr.replace("天", "");
                // } else if (row.pat_agestr.indexOf("小时") > -1) {
                //     this.update_pat_unit = "4";
                //     this.update_pat_agestr = row.pat_agestr.replace("小时", "");
                // } else if (row.pat_agestr.indexOf("分钟") > -1) {
                //     this.update_pat_unit = "5";
                //     this.update_pat_agestr = row.pat_agestr.replace("分钟", "");
                // }

                this.popPatInfovisible = true;
            }
            else if (column.property == "barcode") {
                //预制模式下
                if (this.options.prebarcodemode == "1") {
                    if(!row.req_barcode_head || !row.req_barcode_length || !row.barcode || row.req_barcode_head == 'CREATE'){
                        return;
                    }
                    this.clickrow = row;
                    this.dbclick_barcode = row.barcode;
                    this.dialogShowChangeBarcode = true;
                    this.$nextTick(() => {
                        this.$refs.dbclick_scanbarcode.focus();
                        this.$refs.dbclick_scanbarcode.select();
                    });
                }
            }
        },
        changeBarcodeClick(){
            if(!this.dbclick_newbarcode){
                this.$message.warning("请扫描需要替换的条码！");
                setTimeout(() => {
                    this.$nextTick(() => {
                        this.$refs.dbclick_scanbarcode.focus();
                        this.$refs.dbclick_scanbarcode.select();
                    });
                }, 300);
            }
            else {
                let overrow = this.curTableData.filter((item) => item.barcode == this.dbclick_newbarcode);
                if (overrow && overrow.length > 0) {
                    this.$message.warning("条码号重复,请检查!");
                    setTimeout(() => {
                        this.$nextTick(() => {
                            this.$refs.dbclick_scanbarcode.focus();
                            this.$refs.dbclick_scanbarcode.select();
                        });
                    }, 300);
                    return;
                }
                //后台检查条码号
                this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "checkprebarcode",
                        barcode: this.dbclick_newbarcode,
                    },
                })
                .then((res) => {
                    if (res.flag == 1) {
                        //判断扫描的条码是否符合当前条码的前缀与长度
                        var req_barcode_head_hid = this.clickrow.req_barcode_head_hid;
                        var starthead = this.clickrow.req_barcode_head_hid;
                        if(req_barcode_head_hid.indexOf(',') != -1){
                            //包含逗号，说明需要兼容多种条码前缀
                            var headArr = req_barcode_head_hid.split(',');
                            headArr.forEach(element => {
                                if(this.dbclick_newbarcode.startsWith(element)){
                                    starthead = element;
                                }
                            });
                        }
                        var req_barcode_length = this.clickrow.req_barcode_length;
                        var barcodelength = parseInt(this.clickrow.req_barcode_length);
                        if(barcodelength == NaN){
                            barcodelength = 0;
                        }
                        if(req_barcode_length.indexOf(',') != -1){
                            //包含逗号，说明需要兼容多种条码长度
                            var lengthArr = req_barcode_length.split(',');
                            lengthArr.forEach(element => {
                                if(this.dbclick_newbarcode.length == parseInt(element)){
                                    barcodelength = parseInt(element);
                                }
                            });
                        }
                        if (this.dbclick_newbarcode.startsWith(starthead) && this.dbclick_newbarcode.length == barcodelength) {
                            //批量替换相同的条码
                            var cData = this.curTableData.filter((t) => t.bselect == true && t.endflag == "1");
                            for (let index = 0; index < cData.length; index++) {
                                const element = cData[index];
                                if(element.barcode == this.dbclick_barcode){
                                    cData[index].barcode = this.dbclick_newbarcode;
                                }
                            }

                            this.dialogShowChangeBarcode = false;
                            this.dbclick_newbarcode='';
                            this.barscanfocus();
                        }
                        else{
                            this.$alert("当前扫描的条码不匹配，请重新扫描！", "错误", {
                                confirmButtonText: "确定",
                                showClose: false,
                            }).then(() => {
                                this.$nextTick(() => {
                                    this.$refs.dbclick_scanbarcode.focus();
                                    this.$refs.dbclick_scanbarcode.select();
                                });
                            });
                        }
                    } else {
                        this.$alert(res.msg, "错误", {
                            confirmButtonText: "确定",
                            showClose: false,
                        }).then(() => {
                            this.$nextTick(() => {
                                this.$refs.dbclick_scanbarcode.focus();
                                this.$refs.dbclick_scanbarcode.select();
                            });
                        });
                    }
                })
                .catch((e) => {
                    alert(e);
                });
            }
        },
        clearBarcodeClick(){
            //批量清除相同的条码
            var cData = this.curTableData.filter((t) => t.bselect == true && t.endflag == "1");
            console.log(cData)
            for (let index = 0; index < cData.length; index++) {
                const element = cData[index];
                if(element.barcode == this.dbclick_barcode){
                    cData[index].barcode = '';
                    cData[index].endflag = '';
                }
            }

            this.dialogShowChangeBarcode = false;
            this.dbclick_newbarcode='';
            this.barscanfocus();
        },
        cancleBarcodeClick(){
            this.dialogShowChangeBarcode = false;
            this.dbclick_newbarcode='';
            this.barscanfocus();
        },
        PatinfoSave() {
            this.popPatInfovisible = false;
            // if (this.update_pat_agestr != this.oldagestr) {
            //     this.ischange = "1";
            // }

            this.curTableData.forEach((item) => {
                item.pat_name = this.update_pat_name;
                item.pat_nameen = this.update_pat_nameen;
                item.pat_sex = this.update_pat_sex;
                if (this.update_pat_sex == "1") {
                    item.pat_sexname = "男";
                } else if (this.update_pat_sex == "2") {
                    item.pat_sexname = "女";
                } else {
                    item.pat_sexname = "未知";
                }

                // switch (this.update_pat_unit) {
                //     case "1":
                //         item.pat_agestr = this.update_pat_agestr + "岁";
                //         break;
                //     case "2":
                //         item.pat_agestr = this.update_pat_agestr + "月";
                //         break;
                //     case "3":
                //         item.pat_agestr = this.update_pat_agestr + "天";
                //         break;
                //     case "4":
                //         item.pat_agestr = this.update_pat_agestr + "小时";
                //         break;
                //     default:
                //         item.pat_agestr = this.update_pat_agestr + "分钟";
                //         break;
                // }

                item.pat_phone = this.update_pat_phone;
                item.pat_address = this.update_pat_address;
                item.pat_idcardno = this.update_pat_idcardno;
                item.req_comm = this.update_req_comm;
                item.pat_othno1 = this.update_pat_othno1;
                item.pat_othno2 = this.update_pat_othno2;
                item.pat_othno3 = this.update_pat_othno3;
            });
        },
        PatinfoCancel() {
            this.popPatInfovisible = false;
        },

        popsam_detailchange(c, n) {
            this.popsampledetailvisible = false;
            //this.clickrow.sample_detail = n;
            this.clickrow.sample_detail = n;
        },

        ActiveMethod({ row }) {
            return true;
        },
        //转换json格式时间的方法 如/Date(1294499956278+0800)/转换为正常
        ConvertJSONDateToJSDateObject(JSONDateString) {
            var date = new Date(parseInt(JSONDateString.replace("/Date(", "").replace(")/", ""), 10));
            var datastr = XEUtils.toDateString(date, "yyyy-MM-dd HH:mm:ss");;
            return datastr;
        },
        popSpec_change(c, n) {
            this.popSpecVisible = false;
            this.clickrow.specimen_name = n;
            this.clickrow.specimen_code = c;
            if (this.clickrow.selectflag != -1) {
                this.clickrow.bselect = true;
                this.chkselect_change({}, { row: this.clickrow });
            }
            if (this.options.prebarcodemode == "1") {
                this.$tool
                    .request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "getbarheadlength",
                            clickrowdata: this.clickrow,
                            specimen_code: this.clickrow.specimen_code,
                        },
                    })
                    .then((res) => {
                        if(!!res.req_dt && res.req_dt.indexOf("Date(") != -1){
                            res.req_dt = this.ConvertJSONDateToJSDateObject(res.req_dt);
                        }
                        if(!!res.charge_dt && res.charge_dt.indexOf("Date(") != -1){
                            res.charge_dt = this.ConvertJSONDateToJSDateObject(res.charge_dt);
                        }
                        Object.assign(this.clickrow, res);
                        // this.clickrow.req_groupid = res.Item1;
                        // this.clickrow.req_groupna = res.Item2;

                        // this.clickrow.req_barcode_head = res.Item3;
                        // this.clickrow.req_barcode_head_hid = res.Item4;
                        // this.clickrow.req_barcode_length = res.Item5;
                    })
                    .catch((e) => {});
            }

            setTimeout(() => {
                this.showselinfo();
            },500);
        },
        modifySpec_change(selectrow,c, n) {
            selectrow.specimen_name = n;
            selectrow.specimen_code = c;
            if (this.options.prebarcodemode == "1") {
                this.$tool
                    .request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "getbarheadlength",
                            clickrowdata: selectrow,
                            specimen_code: selectrow.specimen_code,
                        },
                    })
                    .then((res) => {
                        if(!!res.req_dt && res.req_dt.indexOf("Date(") != -1){
                            res.req_dt = this.ConvertJSONDateToJSDateObject(res.req_dt);
                        }
                        if(!!res.charge_dt && res.charge_dt.indexOf("Date(") != -1){
                            res.charge_dt = this.ConvertJSONDateToJSDateObject(res.charge_dt);
                        }
                        Object.assign(selectrow, res);
                    })
                    .catch((e) => {});
            }
        },
        formatterEmerFlag({ cellValue }) {
            if (cellValue == "1") return "急";
            else return "";
        },
        formatterConsumableType({ cellValue, column, row }) {
            try {
                let warditemname = this.options.warditemkindoptions.find((m) => m.value == cellValue);
                if (warditemname != undefined && warditemname != null) {
                    return warditemname.label;
                } else {
                    return cellValue;
                }
            } catch { }
        },
        defineQdate_change() {
            this.datedisabled = !this.bUsrDefineQdate;
        },
        chkselect_change(e, { row }) {
            if (row.specimen_code == "") {
                this.$message.error("没有标本类型，必须先选择标本类型后再选择！");
                row.bselect = false;
                return;
            }
            if(row.isNoLocalItem == "1"){
                this.$confirm("该项目为非本地采样项目，" + " <br/>确定要选择吗？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        focusCancelButton: true,
                        closeOnClickModal: false,
                        dangerouslyUseHTMLString: true,
                        showClose: false,
                        type: "warning",
                    })
                    .then(() => {})
                    .catch(() => {
                        row.bselect = false;
                    });
            }
            var warninglist = new Array();
            var errorlist = new Array();
            var errormsg = "";
            var warningmsg = "";
            //先检测当前勾选的数据是否有问题
            if (row.bselect) {
                if (this.options.sameitemselect == "1") {
                    //相同项目只能选择一条
                    var row_req_groupid = "," + row.req_groupid + ",";
                    if(!this.options.cx_notjudgesameitem || ("," + this.options.cx_notjudgesameitem + ",").indexOf(row_req_groupid) == -1){
                        let cData = this.curTableData.filter((item) => item.bselect && item.req_itemcode == row.req_itemcode && item.iPos != row.iPos);
                        if (cData && cData.length > 0) {
                            var msg = "重复项目只能选择一条！ " + row.req_itemname + "[" + row.req_itemcode + "]；";
                            row.bselect = false;
                            this.$message({
                                message: msg,
                                dangerouslyUseHTMLString: true,
                                type: "error",
                            });
                            return;
                        }
                    }
                }
                if (row.specimen_code == "") {
                    var msg = row.req_itemname + "[" + row.req_itemcode + "]没有标本类型，必须先选择标本类型后再选择！" + "<br/>";
                    row.bselect = false;
                    this.$message({
                        message: msg,
                        dangerouslyUseHTMLString: true,
                        type: "error",
                    });
                    return;
                }

                if (row.labweek != "") {
                    warninglist.push(row);
                    warningmsg += row.req_itemname + "[" + row.req_itemcode + "]" + row.labweek + ";" + "<br/>";
                }
            }
            var rowlist= this.SetTogetherSelectRow(row);//获取相同项目
            var copyRList = XEUtils.clone(rowlist, true);
            rowlist.forEach((val) => {
                copyRList.splice(0,1);//去掉当前循环的这一条
                if (row.bselect) {
                    if (this.options.sameitemselect == "1") {
                        //相同项目只能选择一条
                        var val_req_groupid = "," + val.req_groupid + ",";
                        if(!this.options.cx_notjudgesameitem || ("," + this.options.cx_notjudgesameitem + ",").indexOf(val_req_groupid) == -1){
                            //和已经勾选的判断是否重复
                            let cData = this.curTableData.filter((item) => item.bselect && item.req_itemcode == val.req_itemcode && item.iPos != val.iPos);
                            if (cData && cData.length > 0) {
                                errorlist.push(val);
                                errormsg = errormsg + "重复项目只能选择一条！ " + val.req_itemname + "[" + val.req_itemcode + "]；";
                            }
                            //和当前条码相同的判断是否重复
                            let rData = copyRList.filter((item) => item.req_itemcode == val.req_itemcode && item.iPos != val.iPos);
                            //检查相同条码下，重复的项目
                            if (rData && rData.length > 0) {
                                rData.forEach(element => {
                                    errorlist.push(element);
                                    var eIndex = copyRList.findIndex(function (item) {
                                        if (item.req_itemcode == element.req_itemcode && item.iPos == element.iPos) {
                                            return true;
                                        }
                                    });
                                    var rIndex = rowlist.findIndex(function (item) {
                                        if (item.req_itemcode == element.req_itemcode && item.iPos == element.iPos) {
                                            return true;
                                        }
                                    });
                                    copyRList.splice(eIndex,1);//去掉已经查询到重复的这一条
                                    rowlist.splice(rIndex,1);//去掉已经查询到重复的这一条
                                });
                                errormsg = errormsg + "重复项目只能选择一条！ " + val.req_itemname + "[" + val.req_itemcode + "]；";
                            }
                        }
                    }
                    if (val.specimen_code == "") {
                        errormsg = errormsg + val.req_itemname + "[" + val.req_itemcode + "]没有标本类型，必须先选择标本类型后再选择！" + "<br/>";
                        errorlist.push(val);
                    }
                    //这里还需要优化，如果需要同时选中时，提示语要找一下同批的医嘱
                    if (val.labweek != "" && val.iPos != row.iPos) {
                        warninglist.push(val);
                        if(this.options.barcodeisorignalno == '1'){
                            warningmsg += val.req_itemname + "[" + val.req_itemcode + "]" + val.labweek + ";" + "<br/>";
                        }
                        else if (val.master_his_recordid == row.master_his_recordid) {
                            //拆分出的项目需要一起选择，一起取消
                            warningmsg += val.req_itemname + "[" + val.req_itemcode + "]" + val.labweek + ";" + "<br/>";
                        }
                    }
                }
            });
            this.curr_checkrowinfo = row;
            if (row.bselect) {
                if(this.options.barcodeisorignalno == '1'){
                    //条码直接使用his原始单号
                    if(warninglist.length > 0){
                        this.$confirm(warningmsg + " <br/>确定要选择吗？", "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            focusCancelButton: true,
                            closeOnClickModal: false,
                            dangerouslyUseHTMLString: true,
                            type: "warning",
                        })
                            .then(() => {
                                this.checkmutexItem(rowlist,errorlist,warninglist);
                            })
                            .catch(() => {
                                rowlist.forEach((item) => {
                                    item.bselect = false;
                                });
                                this.showselinfo();
                            });
                    }
                    else{
                        this.checkmutexItem(rowlist,errorlist,warninglist);
                    }
                }
                else {
                    if(warninglist.length > 0 && warninglist[0] == row){
                        //当前的就是需要进行提示的数据
                        this.$confirm(warningmsg + " <br/>确定要选择吗？", "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            focusCancelButton: true,
                            closeOnClickModal: false,
                            dangerouslyUseHTMLString: true,
                            type: "warning",
                        })
                            .then(() => {
                                //去除warninglist里的当前数据
                                warninglist.splice(0,1);
                                //去掉warninglist里，master_his_recordid和当前相同的数据，为了拆分出来的项目，可以同时选择
                                var copywarninglist = XEUtils.clone(warninglist, true);
                                copywarninglist.forEach((crow) => {
                                    if(crow.master_his_recordid == row.master_his_recordid){
                                        let rowindex = warninglist.findIndex(function (item) {
                                            if (item == crow) {
                                                return true;
                                            }
                                        });
                                        warninglist.splice(rowindex,1);
                                    }
                                });
                                this.checkmutexItem(rowlist,errorlist,warninglist);
                            })
                            .catch(() => {
                                row.bselect = false;
                                this.showselinfo();
                            });
                    }
                    else{
                        this.checkmutexItem(rowlist,errorlist,warninglist);
                    }
                }
            } else {
                if(this.options.barcodeisorignalno == '1'){
                    //条码直接使用his原始单号
                    rowlist.forEach((item) => {
                        item.bselect = false;
                    });
                }
                else{
                    //只取消当前的医嘱，不需要全部都取消
                    row.bselect = false;
                    //拆分项目一起取消
                    rowlist.forEach((item) => {
                        if(item.master_his_recordid == row.master_his_recordid){
                            item.bselect = false;
                        }
                    });
                }
                this.showselinfo();
            }
        },
        checkmutexItem(rowlist,errorlist,warninglist) {
            let ischeck = false;
            let reqitemname = "";
            for (let index = 0; index < rowlist.length; index++) {
                let element = rowlist[index];
                let currowstr = element.req_groupid + "[FG]" + element.specimen_code + "[FG]" + element.emer_flag + "[FG]" + element.perform_dept;

                if (this.options.groupField.indexOf("pat_no") >= 0) currowstr += "[FG]" + element.pat_no;
                if (this.options.groupField.indexOf("pat_name") >= 0) currowstr += "[FG]" + element.pat_name;
                if (this.options.groupField.indexOf("inp_id") >= 0) currowstr += "[FG]" + element.inp_id;
                if (this.options.groupField.indexOf("pat_id") >= 0) currowstr += "[FG]" + element.pat_id;
                if (this.options.groupField.indexOf("req_deptno") >= 0) currowstr += "[FG]" + element.req_deptno;
                if (this.options.groupField.indexOf("req_docno") >= 0) currowstr += "[FG]" + element.req_docno;
                if (this.options.groupField.indexOf("original_reqno") >= 0) currowstr += "[FG]" + element.original_reqno;

                for (let i = 0; i < this.curTableData.length; i++) {
                    let loopitem = this.curTableData[i];
                    if (loopitem.bselect) {
                        let loopstr = loopitem.req_groupid + "[FG]" + loopitem.specimen_code + "[FG]" + loopitem.emer_flag + "[FG]" + loopitem.perform_dept;

                        if (this.options.groupField.indexOf("pat_no") >= 0) loopstr += "[FG]" + loopitem.pat_no;
                        if (this.options.groupField.indexOf("pat_name") >= 0) loopstr += "[FG]" + loopitem.pat_name;
                        if (this.options.groupField.indexOf("inp_id") >= 0) loopstr += "[FG]" + loopitem.inp_id;
                        if (this.options.groupField.indexOf("pat_id") >= 0) loopstr += "[FG]" + loopitem.pat_id;
                        if (this.options.groupField.indexOf("req_deptno") >= 0) loopstr += "[FG]" + loopitem.req_deptno;
                        if (this.options.groupField.indexOf("req_docno") >= 0) loopstr += "[FG]" + loopitem.req_docno;
                        if (this.options.groupField.indexOf("original_reqno") >= 0) loopstr += "[FG]" + loopitem.original_reqno;

                        if (currowstr == loopstr && ("," + loopitem.item_mutex + ",").indexOf("," + element.req_itemcode + ",") >= 0) {
                            if(index == 0){
                                //第一条为当前勾选的数据
                                reqitemname = loopitem.req_itemname;
                                ischeck = true;
                            }
                            else{
                                warninglist.push(element);
                            }
                        }
                    }
                }
            }
            if (ischeck) {
                this.$confirm("该项目与【" + reqitemname + "】为互斥项目，确定要勾选吗？", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    focusCancelButton: true,
                    closeOnClickModal: false,
                    type: "warning",
                })
                    .then(() => {
                        if(this.options.barcodeisorignalno == '1'){
                            //条码直接使用his原始单号
                            rowlist.forEach((item) => {
                                item.bselect = true;
                            });
                            errorlist.forEach((item) => {
                                item.bselect = false;
                            });
                        }
                        else{
                            rowlist.forEach((item) => {
                                item.bselect = true;
                            });
                            if(rowlist.length != 1){
                                errorlist.forEach((item) => {
                                    item.bselect = false;
                                });
                                warninglist.forEach((item) => {
                                    item.bselect = false;
                                });
                            }
                        }
                        this.showselinfo();
                    })
                    .catch(() => {
                        rowlist.forEach((item) => {
                            item.bselect = false;
                        });
                        this.showselinfo();
                    });
            } else {
                if(this.options.barcodeisorignalno == '1'){
                    //条码直接使用his原始单号
                    rowlist.forEach((item) => {
                        item.bselect = true;
                    });
                    errorlist.forEach((item) => {
                        item.bselect = false;
                    });
                }
                else {
                    rowlist.forEach((item) => {
                        item.bselect = true;
                    });
                    if(rowlist.length != 1){
                        errorlist.forEach((item) => {
                            item.bselect = false;
                        });
                        warninglist.forEach((item) => {
                            item.bselect = false;
                        });
                    }
                }
                this.showselinfo();
            }
        },

        SetTogetherSelectRow(row) {
            var rowlist = new Array();
            rowlist.push(row);
            for (let i = 0; i < this.curTableData.length; i++) {
                let loopitem = this.curTableData[i];
                //跳过当前的这条医嘱
                if (loopitem.iPos == row.iPos) {
                    continue;
                }
                //不能选择的直接跳过
                if (loopitem.strselect == "-1") {
                    continue;
                }
                //条码直接使用HIS原始申请单号，相同HIS原始申请单号必须同时选择
                if ((this.options.barcodeisorignalno == "1" || this.cxorignalnobatchselect)) {
                    if(row.original_reqno && loopitem.original_reqno == row.original_reqno){
                        rowlist.push(loopitem);
                        continue;
                    }
                    else if(loopitem.barcode == row.barcode){
                        rowlist.push(loopitem);
                        continue;
                    }
                }
                //拆分出来的项目同时选择
                if (row.master_his_recordid != "" && row.master_his_recordid == loopitem.master_his_recordid) {
                    rowlist.push(loopitem);
                    continue;
                }
                if(this.options.barcodeisorignalno != "1" && this.options.selectsameitems == '1' && loopitem.bselect == false){
                    if(this.options.prebarcodemode == "1"){
                        //预制模式
                        if (row.barcode_hid != "" && row.barcode_hid == loopitem.barcode_hid) {
                            rowlist.push(loopitem);
                            continue;
                        }
                    }
                    else{
                        //打印模式
                        if (row.barcode != "" && row.barcode == loopitem.barcode) {
                            rowlist.push(loopitem);
                            continue;
                        }
                    }
                }
            }
            return rowlist;
        },
        querydate_change() {
            this.fixeddateChange();
            this.$refs.txtinputno.focus();
            this.$refs.txtinputno.select();
        },
        txtinputno_enter(btnval) {
            //如果是点击查询按钮触发的方法，通过变量判断
            var isGetPatOrders = btnval;
            //enterMode判断是否在最开始有提示框时，按了回车键跳过提示框，不是为了触发打印
            //tempBarcode判断当前输入框的条码号是否与上一次的一致，一致则是打印，不一致则为查询
            if (this.options.prebarcodemode != "1" && this.options.cxenterprint == "1" && isGetPatOrders != '1' && this.prtbtndisabled == false && this.enterMode == 1 && this.tempBarcode.includes(',' + this.inputno + ',')) {
                //生成条码后默认回车打印（打印条码模式）
                this.btnPrint_click();
                this.enterMode = 0;
            }
            else {
                if(this.enterMode != 3){
                    this.GetPatOrders();
                    this.activeName = "curtab";
                    this.enterMode = 1;
                }
            }

            // if (this.activeName == "historytab") {
            //     this.getpathistory();
            // }
        },
        btnreset_click() {
            // if (this.prebarcodemode == "1" && this.curTableData.filter(item => item.barcode).length > 0) {
            //     this.$confirm("扫描的试管还未保存，确定要清空页面吗？", "提示", {
            //         confirmButtonText: "确定",
            //         cancelButtonText: "取消",
            //         focusCancelButton: true,
            //         closeOnClickModal: false,
            //         type: "warning"
            //     }).then(() => {
            //         this.InitPageDate();
            //         this.$refs.txtinputno.focus();
            //     });
            // } else {
            //     this.InitPageDate();
            //     this.$refs.txtinputno.focus();
            // }
            this.InitPageDate();
            this.$refs.txtinputno.focus();
            //this.barmsg = "测试错误消息：条码类别或长度错误，请根据颜色提示使用正确的试管！";
        },
        qdradio_change() {
            if (this.chk_fixeddate != "1") {
                this.SetQueryDate();
            }
        },
        SetQueryDate() {
            let days = parseInt(this.options.dateinterval) - 1;
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * days);
            var strstart = start.getFullYear() + "-" + (start.getMonth() + 1) + "-" + start.getDate();
            var strend = end.getFullYear() + "-" + (end.getMonth() + 1) + "-" + end.getDate();
            var strstart_tmp = new Date(strstart);
            var strend_tmp = new Date(strend);
            this.querydate1 = XEUtils.toDateString(strstart_tmp, "yyyy-MM-dd");
            this.querydate2 = XEUtils.toDateString(strend_tmp, "yyyy-MM-dd");
        },
        ClearHistory() {
            this.refhistory = false;
            this.historyTableData = null;
            this.historyDetailTableData = [];
            this.tableDatalog = [];
            this.historycolor = false; // "black";
        },
        GetPatOrders() {
            if(!this.inputno){
                return false;
            }
            if (this.options.prebarcodemode != "1") {
                //打印模式下，防止数据并发，先设置disable
                this.txtinputnodisabled = true;
            }
            this.ClearHistory();
            this.curloading = true;
            this.noorders = false;
            this.overmoney = "";
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "getpatorders",
                        inputno: this.inputno,
                        cardtype: this.options.cardtype,
                        showhistory: this.options.showhistory,
                        begdt: this.querydate1,
                        enddt: this.querydate2,
                        bnameencrypt: this.bNameEncrypt,
                        prebarcodemode: this.options.prebarcodemode,
                        bShowRepeatItem: this.bShowRepeatItem,
                    },
                })
                .then((res) => {
                    if (this.options.showpatphoto == "1") this.dialogAdvicefloatwindowVisible = true;
                    this.image = res.image;
                    this.patname = res.pat_name;
                    this.currentpatname = res.pat_name;
                    //兼容病人号转为病历号后，输入的病人号与转换出来的不相同
                    this.tempBarcode =',' + this.inputno + ',' + res.showpatno + ',';
                    this.inputno = res.showpatno;
                    this.curloading = false;
                    if (res.errmsg != "") {
                        this.$alert(res.errmsg, "错误", {
                            confirmButtonText: "确定",
                        });
                        this.$refs.txtinputno.focus();
                        this.$refs.txtinputno.select();
                        return;
                    }
                    this.curTableData = res.orders;
                    this.selectall = true;
                    this.showselinfo();
                    if (res.historycnt > 0) {
                        //变红 TODO
                        this.historycolor = true; // "red";
                    }

                    if (res.patcardbalance != "No") {
                        this.overmoneydispay = true;
                        this.overmoney = res.patcardbalance;
                    }

                    if (this.curTableData && this.curTableData.length > 0) {
                        if(res.modifyspecimen.length > 0){
                            this.modifyspecimenData = res.modifyspecimen;
                            //构建数据
                            var groupnamesArr = res.modifygroup;
                            var newArr=[];
                            for (var i = 0; i < groupnamesArr.length; i++) {
                                var item_groupname = groupnamesArr[i];
                                var item=[];
                                for (var j = 0; j < res.modifyspecimen.length; j++) {
                                    var item_modifyspecimen = res.modifyspecimen[j];
                                    if(item_groupname.Item1 == item_modifyspecimen.Item1){
                                        item.push(item_modifyspecimen);
                                    }
                                }
                                //默认选项不修改
                                item.push({Item1: item_groupname.Item1,Item2: item_groupname.Item2,Item3: "not",Item4: "不修改",Item5: "not_不修改"});
                                newArr.push({
                                        groupName: item_groupname.Item2,
                                        groupCode: item_groupname.Item1,
                                        value:"not",
                                        subList: item
                                    });
                            }
                            this.modifySpecimenObj = newArr;
                            //弹出修改框
                            this.showModifySpecimen = true;
                        }
                        this.samespecimenMsg = "";
                        if (this.options.promptsameitem == "1") {
                            var cDataCopy = XEUtils.clone(this.curTableData, true);
                            for (let i = 0; i < this.curTableData.length; i++) {
                                //发现相同项目时提醒用户
                                //去掉当前循环的数据,每次去掉当前的第一条数据
                                cDataCopy.splice(0, 1);
                                //查找是否有重复的项目
                                let sameitem = cDataCopy.find((t) => t.req_itemcode == this.curTableData[i].req_itemcode && t.req_groupid == this.curTableData[i].req_groupid && !t.is_used && t.isShow != '1');
                                //分单类别为空或未设置的不提示
                                if (!!sameitem && !!sameitem.req_groupid) {
                                    if(!this.samespecimenMsg.includes(this.curTableData[i].reqdisplayname)){
                                        this.samespecimenMsg += this.curTableData[i].reqdisplayname + "，";
                                    }
                                }
                            }
                        }
                        this.nottodayitemsMsg ="";
                        if (this.options.remindhavenottodayitem == "1") {
                            let currdate = XEUtils.toDateString(new Date(), "yyyy-MM-dd");
                            for (let i = 0; i < this.curTableData.length; i++) {
                                //存在非当天医嘱时弹窗提醒
                                let reqdt = XEUtils.toDateString(this.curTableData[i].req_dt, "yyyy-MM-dd");
                                if (currdate != reqdt) {
                                    if(!this.nottodayitemsMsg.includes(this.curTableData[i].reqdisplayname)){
                                        this.nottodayitemsMsg += this.curTableData[i].reqdisplayname + "，";
                                    }
                                }
                            }
                        }
                        this.msgTipContent = '';
						if(!!this.options.differentvalremindfield){
                            //值不同需要弹窗提醒的字段
                            let cMsgTipCopy = this.curTableData.filter((t) => t.strselect != '-1');//获取全部可选的数据
                            if(!!cMsgTipCopy && cMsgTipCopy.length > 0){
                                var fieldArr = this.options.differentvalremindfield.split(',');
                                var fieldNameArr = this.options.remindfieldname.split('|');
                                fieldArr.forEach(element => {
                                    //取医嘱的第一条数据的值
                                    let firstVal = cMsgTipCopy[0][cMsgTipCopy];
                                    //用第一条的值去和其他的进行比较，若不同，则进行提示
                                    for (let index = 0; index < cMsgTipCopy.length; index++) {
                                        const item = cMsgTipCopy[index];
                                        if(firstVal != item[element]){
                                            let fieldNaAarr = fieldNameArr.find((s)=> s.indexOf(element + ',') > -1);
                                            if(!!fieldNaAarr){
                                                this.msgTipContent += '['+ fieldNaAarr.split(',')[1] + "]，";
                                            }
                                            break;
                                        }
                                    }
                                });
                            }
						}
                        //处理弹窗提示内容
                        this.tipmsgFlag = '0';
                        if (res.tipmsg != "") {
                            this.tipmsgFlag = '1';
                            this.showMsgTip = true;
                            this.tipmsg = res.tipmsg;
                        }
                        this.samespecimenFlag = '0';
                        if (this.options.promptsameitem == "1" && this.samespecimenMsg != "") {
                            this.samespecimenFlag = '1';
                            this.showMsgTip = true;
                            this.samespecimenMsg = "提取的医嘱中：" + this.samespecimenMsg.substring(0, this.samespecimenMsg.length - 1) + "这些申请项目存在重复！";
                        }
                        this.nottodayitemsFlag = '0';
                        if (this.options.remindhavenottodayitem == "1" && this.nottodayitemsMsg != "") {
                            this.nottodayitemsFlag = '1';
                            this.showMsgTip = true;
                            this.nottodayitemsMsg = "提取的医嘱中：" + this.nottodayitemsMsg.substring(0, this.nottodayitemsMsg.length - 1) + "这些申请项目申请时间不是当天！";
                        }
                        this.msgTipContentFlag = '0';
                        if (!!this.options.differentvalremindfield && this.msgTipContent != "") {
                            this.msgTipContentFlag = '1';
                            this.showMsgTip = true;
                            this.msgTipContent = '提取的医嘱中：有不同' + this.msgTipContent.substring(0, this.msgTipContent.length - 1) + '的申请项目，请仔细查对！';
                        }
                        if(this.showMsgTip == true) {
                            this.enterMode = 3;//防止弹出确认框后，一直按回车键，一直不停的查询输入号码
                        }

                        this.patname = this.curTableData[0].pat_name;
                        this.currentpatname = this.curTableData[0].pat_name;
                        this.prtbtndisabled = false;
                        if (this.barscandispay) {
                            this.barmsg = "";
                            this.txtinputnodisabled = true;
                            this.barscandisabled = false;
                            this.$nextTick(() => {
                                this.$refs.txtbarsacn.focus();
                                this.$refs.txtbarsacn.select();
                            });
                        } else {
                            this.$nextTick(() => {
                                this.$refs.txtinputno.focus();
                                this.$refs.txtinputno.select();
                            });
                        }

                        if (this.options.inputpatsexage == "1") {
                            let popage = true;
                            if (this.options.inputnosexage == "1") {
                                if (this.curTableData[0].pat_sex != "" && this.curTableData[0].pat_agestr != "") {
                                    popage = false;
                                }
                            }
                            if (popage) {
                                let patage = this.curTableData[0].pat_agestr;
                                this.poppatinfo = {
                                    txtpatname: this.curTableData[0].pat_name,
                                    txtpatsex: this.curTableData[0].pat_sexname,
                                    txtpatage: patage,
                                    txtpatphone: this.curTableData[0].pat_phone,
                                    txtpataddr: this.curTableData[0].pat_address,
                                    txtpatidcard: this.curTableData[0].pat_idcardno,
                                    txtreqcomm: this.curTableData[0].req_comm,
                                };
                                this.poppatinfo.ddlageunit = "岁";
                                let agenum = "";
                                if (patage != "") {
                                    for (let i = 0; i < this.ageunits.length; i++) {
                                        if (patage.indexOf(this.ageunits[i].value) > -1) {
                                            this.poppatinfo.ddlageunit = this.ageunits[i].value;
                                            for (let j = 0; j < patage.length; j++) {
                                                if ("1234567890".indexOf(patage[j]) > -1) {
                                                    agenum += patage[j];
                                                }
                                            }
                                            this.poppatinfo.txtpatage = agenum;
                                        }
                                    }
                                }
                                this.popPatAgeInputVisible = true;
                                this.$nextTick(() => {
                                    this.$refs.txtpatsex.$refs.input.focus();
                                    this.$refs.txtpatsex.$refs.input.select();
                                });
                            }
                        }
                        if (this.options.cxautosavescanlast == "1" && this.options.prebarcodemode != "1") {
                            this.btnPrint_click();
                        }
                    } else {
                        this.noorders = true;
                        let that = this;
                        this.$nextTick(() => {
                            that.$refs.txtinputno.focus();
                            that.$refs.txtinputno.select();
                        });
                    }
                    if (this.options.prebarcodemode != "1") {
                        //打印模式下，执行完成，放开disable，并聚焦
                        this.txtinputnodisabled = false;
                        //取消聚焦
                        // this.$nextTick(() => {
                        //     this.$refs.txtinputno.focus();
                        //     this.$refs.txtinputno.select();
                        // });
                    }
                })
                .catch((e) => {
                    this.curloading = false;
                    this.historyloading = false;
                    console.log("error", e);
                    if (this.options.prebarcodemode != "1") {
                        //打印模式下，执行完成，放开disable，并聚焦
                        this.txtinputnodisabled = false;
                        this.$nextTick(() => {
                            this.$refs.txtinputno.focus();
                            this.$refs.txtinputno.select();
                        });
                    }
                });
        },
        closeShowMsgTip(){
            this.enterMode = 1;
            this.showMsgTip = false;
        },
        txtpatinfo_enter(ctrlindex) {
            if (ctrlindex == this.$refs.patinfopoptable.$el.length - 1) {
                this.$nextTick(() => {
                    this.$refs.patinfopoptable.$el[ctrlindex].blur();
                    this.$refs.btnsavepatinfo.focus();
                });
            } else {
                if (ctrlindex == 1) {
                    if (this.poppatinfo.txtpatsex == "1") this.poppatinfo.txtpatsex = "男";
                    else if (this.poppatinfo.txtpatsex == "2") this.poppatinfo.txtpatsex = "女";
                }
                this.$nextTick(() => {
                    if (ctrlindex == 3) {
                        this.$refs.patinfoage.blur();
                    }
                    this.$refs.patinfopoptable.$el[ctrlindex].blur();
                    this.$refs.patinfopoptable.$el[ctrlindex + 1].focus();
                    this.$refs.patinfopoptable.$el[ctrlindex + 1].select();
                });
            }
        },
        modifySpecimenFun(){
            for (var i = 0; i < this.modifySpecimenObj.length; i++) {
                var item = this.modifySpecimenObj[i];
                if(!!item.value && item.value != 'not'){
                    var sel_specimeninfo = this.modifyspecimenData.filter((s) => s.Item3 == item.value);
                    //找到页面上对应的数据
                    if(sel_specimeninfo.length > 0){
                        var specimen_rows = this.curTableData.filter((s) => s.req_groupid == item.groupCode && s.req_groupna == item.groupName && s.specimen_name != sel_specimeninfo[0].Item4 && s.specimen_code != item.value);
                        for (var j = 0; j < specimen_rows.length; j++){
                            var curr_row = specimen_rows[j];
                            var selectrow = curr_row;
                            //更换标本类型
                            this.modifySpec_change(selectrow,item.value, sel_specimeninfo[0].Item4);
                        }
                    }
                }
            }
            setTimeout(() => {
                this.showselinfo();
            },1000);
            this.showModifySpecimen = false;
        },
        chkselectallhistory_change() {
            if (this.historyTableData != null && this.historyTableData.length > 0) {
                this.historyTableData.forEach((item) => {
                    if (item.req_stat != "9" && !(item.req_stat >= "4" && this.options.noprintbarcodercv == "1")) {
                        item.selectflag = this.selectallhistory;
                    }
                });
            }
        },
        chkselecthistory_change(e, { row }) {
            //拆分的条码一起选择
            if (row.master_barcode) {
                this.historyTableData.forEach((item) => {
                    if (row.master_barcode == item.master_barcode) {
                        if (item.req_stat != "9" && !(item.req_stat >= "4" && this.options.noprintbarcodercv == "1")) {
                            item.selectflag = row.selectflag;
                        }
                    }
                });
            }
        },

        chkselectall_change(e) {
            let sameitem = "";
            if (this.curTableData != null && this.curTableData.length > 0) {
                this.curTableData.forEach((item) => {
                    if (item.strselect != "-1") {
                        // 根据系统设置决定是否根据申请时间进行勾选
                        if (this.chkbyreqdt(item.req_dt)) {
                            item.bselect = false;
                            return;
                        }

                        if (this.selectall) {
                            if (item.strselect == "1") {
                                item.bselect = true;
                            } else {
                                item.bselect = false;
                                return;
                            }
                            if (item.specimen_code == "") {
                                item.bselect = false;
                                return;
                            }
                        } else {
                            item.bselect = this.selectall;
                        }
                    }
                });
            }
            this.showselinfo();
        },
        // 根据申请时间判断是否要勾选
        chkbyreqdt(req_dt) {
            if (req_dt || req_dt != null) {
                const nowDate = new Date();
                nowDate.setTime(nowDate.getTime());
                let today = Date.parse(nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate() + " 23:59:59");
                let yesterday = Date.parse(nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + (nowDate.getDate() - 1) + " 23:59:59");
                let requestday = Date.parse(req_dt);
                // 0 全部选择|1 仅选择当日和当日之前的申请|2 仅选择当日的申请
                if ((this.options.selectreqdtbeforetoday == "1" && requestday > today) || (this.options.selectreqdtbeforetoday == "2" && (requestday > today || requestday <= yesterday))) {
                    return true;
                }
            } else if (this.options.selectreqdtbeforetoday == "2") {
                // 仅选择当日的申请时申请日期为空不勾选
                return true;
            }

            return false;
        },
        changepatinfo_click() {
            this.popPatAgeInputVisible = false;
            this.curTableData.forEach((item) => {
                item.pat_name = this.poppatinfo.txtpatname;
                item.pat_sexname = this.poppatinfo.txtpatsex;
                item.pat_sex = this.poppatinfo.txtpatsex == "男" ? "1" : this.poppatinfo.txtpatsex == "女" ? "2" : this.poppatinfo.txtpatsex;
                item.pat_agestr = this.poppatinfo.txtpatage + this.poppatinfo.ddlageunit;
                item.pat_phone = this.poppatinfo.txtpatphone;
                item.pat_address = this.poppatinfo.txtpataddr;
                item.pat_idcardno = this.poppatinfo.txtpatidcard;
                item.req_comm = this.poppatinfo.txtreqcomm;
            });
            if (this.barscandispay) {
                this.$nextTick(() => {
                    this.$refs.txtbarsacn.focus();
                });
            }
        },
        InitPageDate() {
            this.barmsg = "";
            this.barcodestr = "";
            this.itemcnt = "0项";
            this.barcnt = "0个条码";
            this.sumamount = "合计：0.00";
            this.bUsrDefineQdate = false;
            this.curTableData = null;
            this.historyTableData = null;
            this.historyDetailTableData = [];
            this.tableDatalog=[];
            this.txtinputnodisabled = false;
            this.barscandisabled = true;
            this.reprtbtndisabled = true;
            this.prtbtndisabled = true;
            this.endflag = false;
            this.inputno = "";
            this.overmoney = "";
            this.selectall = false;
            this.noorders = false;
            this.historycolor = false;
            this.tempBarcode ='';
            if (this.$refs.txtinputno) {
                this.$refs.txtinputno.focus();
                this.$refs.txtinputno.select();
            }
            this.txtbarsacn = "";
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "getoptions",
                    },
                })
                .then((res) => {
                    //此处要优化
                    this.options = res;
                    //检测是否设置本地采样窗口
                    if(this.options.unsetlocalwindownotreq == '1'){
                        if(!this.options.callwindow){
                            this.$confirm("请先设置本地采集/叫号窗口！", "提示", {
                                confirmButtonText: "确定",
                                showClose: false,
                                showCancelButton: false,
                                type: "warning",
                            })
                                .then(() => {
                                    this.closeTag();
                                })
                                .catch(() => {
                                    this.closeTag();
                                });
                        }
                    }
                    this.dateinterval_init = res.dateinterval;
                    if (this.chk_fixeddate != "1") {
                        this.SetQueryDate();
                    }
                    if (this.options.prebarcodemode == "1") {
                        this.barscandispay = true;
                    }
                    if (this.options.cx_printbackrpt == "1") this.bPrintBackBill = true;
                    if (res.reqstat) {
                        let temp = [];
                        res.reqstat.forEach((item, index) => {
                            this.reqstatOptiontable.push(item);
                        });
                        this.reqstatOptiontable.push({ data: "报告日志", display: "报告日志", inputcode: "BGRZ" });
                        this.reqstatOptiontable.push({ data: "-43", display: "无纸化", inputcode: "WZH" });
                        this.reqstatOptiontable.push({ data: "无纸化", display: "无纸化", inputcode: "WZH" });
                    }
                    if (res.cx_notprintbarcode == "1") {
                        this.IsPrintBarcode = true;
                    }
                    if (this.options.isenablemix == "1") {
                        //开启混采
                        let lastmixbarno = localStorage.getItem("lastmixbarno");
                        if (lastmixbarno) {
                            this.queryMixDetail(lastmixbarno);
                        }
                    }
                    if(res.localshowcallwindow=='1'){
                        //开启排队呼叫窗口
                        this.showcallwindow = true;
                        //使用排队叫号功能时，隔一段时间获取正在等待人数
                        this.getwaitnum();
                    }
                })
                .catch((e) => {
                    console.log("error", e);
                });
            this.getsampleddata();
        },
        closeTag() {
            this.$bus.$emit("closePathTags", "/REQ110");
        },
        tabs_click(tab, event) {
            this.cancelbtndisabled = true;
            if (this.activeName == "sampledtab") {
            } else {
                if (this.inputno == ""){
                    if (this.activeName == "historytab" && this.historyTableData != null && this.historyTableData.length > 0 && this.prtbtndisabled) {
                        //历史采样列表有数据，打印/完成按钮为disable，此时为采样完成，切换tab页面为历史采样的时候取消采样按钮可以点击
                        this.cancelbtndisabled = false;
                    }
                    this.$refs.tbHistory.loadData(this.historyTableData);
                    this.$refs.tablelog.loadData(this.tableDatalog);
                    this.$refs.historyDetailTable.loadData(this.historyDetailTableData);
                    return;
                }
                if (this.activeName == "curtab") {
                    if (this.endflag == false) {
                        if (this.curTableData && this.curTableData.length > 0) {
                            this.prtbtndisabled = false;
                        }
                        this.reprtbtndisabled = true;
                    } else {
                        this.reprtbtndisabled = false;
                    }
                } else if (this.activeName == "historytab") {
                    //this.prtbtndisabled=true;
                    //点击历史采样时，重新加载数据，避免列表样式变形；
                    this.$refs.tbHistory.loadData(this.historyTableData);
                    this.$refs.tablelog.loadData(this.tableDatalog);
                    this.$refs.historyDetailTable.loadData(this.historyDetailTableData);
                    this.getpathistory();
                    this.cancelbtndisabled = false;
                }
            }
        },
        getpathistory() {
            this.prtbtndisabled = true;
            //this.reprtbtndisabled = true;
            if (this.historyTableData != null && this.historyTableData.length > 0) {
                this.reprtbtndisabled = false;
            }
            if (this.refhistory == false) {
                this.historyloading = true;
                let pat_no = "";
                let pat_cardno = "";
                let pat_id = "";
                let inp_id = "";
                let pat_idcardno = "";
                let pat_name = "";
                if (this.curTableData && this.curTableData.length > 0) {
                    pat_no = this.curTableData[0].pat_no;
                    pat_cardno = this.curTableData[0].pat_cardno;
                    pat_id = this.curTableData[0].pat_id;
                    inp_id = this.curTableData[0].inp_id;
                    pat_idcardno = this.curTableData[0].pat_idcardno;
                    pat_name = this.curTableData[0].pat_name;
                }
                this.$tool
                    .request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "getpathistory",
                            inputno: this.inputno,
                            cardtype: this.options.cardtype,
                            showhistory: this.options.showhistory,
                            begdt: this.querydate1,
                            enddt: this.querydate2,
                            pat_no: pat_no,
                            pat_cardno: pat_cardno,
                            pat_id: pat_id,
                            inp_id: inp_id,
                            pat_idcardno: pat_idcardno,
                            pat_name: pat_name,
                        },
                    })
                    .then((res) => {
                        this.refhistory = true;
                        this.historyloading = false;
                        this.historyTableData = res.Data;
                        this.historyDetailTableData = [];
                        this.tableDatalog=[];
                        if (this.historyTableData != null && this.historyTableData.length > 0) {
                            this.reprtbtndisabled = false;
                            var num = 0;
                            this.historyTableData.forEach((element) => {
                                if (this.currentpatname != "" && element.pat_name != this.currentpatname) {
                                    num++;
                                }
                            });
                            if (num != 0) {
                                this.$message.warning("历史采样记录中，共有" + num + "条与当前医嘱的病人姓名不一致！");
                            }
                        }
                    })
                    .catch((e) => {
                        this.historyloading = false;
                        console.log("error", e);
                    });
            }
        },
        barsacn() {
            //this.isErr = false;
            let srow = this.curTableData.filter((item) => item.bselect);
            if (!srow || srow.length == 0) {
                this.$alert("请先选择医嘱", "错误", {
                    confirmButtonText: "确定",
                });
                this.$refs.txtbarsacn.focus();
                this.$refs.txtbarsacn.select();
                return;
            }
            let overrow = this.curTableData.filter((item) => item.barcode == this.barmsg);
            if (overrow && overrow.length > 0) {
                this.barmsg = "条码号重复";
                this.$nextTick(() => {
                    this.$refs.txtbarsacn.focus();
                    this.$refs.txtbarsacn.select();
                });
                return;
            }
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "checkprebarcode",
                        barcode: this.barmsg,
                    },
                })
                .then((res) => {
                    if (res.flag == 1) {
                        this.barmsg = res.barcode;
                        let overrow = this.curTableData.filter((item) => item.barcode == this.barmsg);
                        if (overrow && overrow.length > 0) {
                            this.barmsg = "条码号重复";
                            this.$nextTick(() => {
                                this.$refs.txtbarsacn.focus();
                                this.$refs.txtbarsacn.select();
                            });
                            return;
                        }
                        this.barcodebind();
                        if (this.options.cx_photographtime == "1") {
                            //提取病人检验申请后立即拍照
                            this.autoCameraTakePhoto();
                        }
                    } else {
                        this.barmsg = res.msg;
                        this.$nextTick(() => {
                            this.$refs.txtbarsacn.focus();
                            this.$refs.txtbarsacn.select();
                        });
                    }
                })
                .catch((e) => {
                    alert(e);
                });
        },
        async check_barsacn() {
            var checkmsg = await this.$pub.BarcodeTrans(this.check_barmsg);
            let overrow = this.CheckBarCodeList.filter((item) => item.barcode == checkmsg);
            if (overrow && overrow.length > 0) {
                for (let index = 0; index < overrow.length; index++) {
                    const element = overrow[index];
                    element.check_barcode = checkmsg;
                    //设置当前行变蓝
                    var rowindex = this.CheckBarCodeList.findIndex(function (item) {
                        if (item.barcode == checkmsg && item.reqdisplayname == element.reqdisplayname) {
                            return true;
                        }
                    });
                    //修改数据
                    this.$set(this.CheckBarCodeList, rowindex, element);
                }
                this.check_barmsg = "";
                //检查所有数据是否都已经确认，已确认完成的，自动继续
                this.confirmBarCode();
            } else {
                this.check_barmsg = "当前扫描的条码不正确";
                this.$nextTick(() => {
                    this.$refs.check_txtbarsacn.focus();
                    this.$refs.check_txtbarsacn.select();
                });
            }
        },
        check_rowClassName({ row, rowIndex }) {
            if (!!row.check_barcode) {
                return "check-row";
            }
        },
        confirmBarCode() {
            var isOK = 0;
            for (var i = 0; i < this.CheckBarCodeList.length; i++) {
                var newArr = this.CheckBarCodeList[i];
                if (newArr.check_barcode == "" || newArr.check_barcode == null || newArr.check_barcode == undefined) {
                    isOK = 1;
                    // var rownum=i+1;
                    // this.$alert("第"+rownum+"行,条码号："+newArr.barcode+"未确认", "错误");
                    // return false;
                }
                if (newArr.check_barcode != newArr.barcode) {
                    isOK = 1;
                    // this.$alert("第"+rownum+"行,条码号："+newArr.barcode+"与确认条码号不相同", "错误");
                    // return false;
                }
            }
            if (isOK == 0) {
                this.popBarCodeCheckVisible = false;
                this.GetAddRptItem(this.setOnlybar);
            }
        },
        barcodebind() {
            let find = false;
            var firstrow = "";
            var newestRowIndex = 0;
            var reqitems = [];// 记录当前条码已经绑定的申请项目代码，修正一个条码号里面存着相同申请项目的问题
            for (let index = 0; index < this.curTableData.length; index++) {
                const e = this.curTableData[index];
                if (e.bselect && e.endflag != "1" && e.premodeprt != "1") {
                    var req_barcode_head_hid = e.req_barcode_head_hid;
                    var starthead = e.req_barcode_head_hid;
                    if(req_barcode_head_hid.indexOf(',') != -1){
                        //包含逗号，说明需要兼容多种条码前缀
                        var headArr = req_barcode_head_hid.split(',');
                        headArr.forEach(element => {
                            if(this.barmsg.startsWith(element)){
                                starthead = element;
                            }
                        });
                    }
                    var req_barcode_length = e.req_barcode_length;
                    var barcodelength = parseInt(e.req_barcode_length);
                    if(barcodelength == NaN){
                        barcodelength = 0;
                    }
                    if(req_barcode_length.indexOf(',') != -1){
                        //包含逗号，说明需要兼容多种条码长度
                        var lengthArr = req_barcode_length.split(',');
                        lengthArr.forEach(element => {
                            if(this.barmsg.length == parseInt(element)){
                                barcodelength = parseInt(element);
                            }
                        });
                    }
                    if (this.barmsg.startsWith(starthead) && this.barmsg.length == barcodelength) {
                        if (e.singletube != "1") {
                            e.singletube = "0";
                        }
                        if(!reqitems.some(item=>item == e.req_itemcode)){
                            let currow = e.req_groupid + "[RM]" + e.specimen_code + "[RM]" + e.emer_flag + "[RM]" + e.perform_dept + "[RM]" + e.singletube;
                            if (firstrow == "" || firstrow == currow) {
                                firstrow = currow;
                                e.barcode = this.barmsg;
                                reqitems.push(e.req_itemcode);
                                e.endflag = "1";
                                find = true;
                                newestRowIndex = index;
                            }
                            if (find && e.singletube == "1") {
                                break;
                            }
                        }
                    }
                }
            }
            if (find == false) {
                //this.isErr = true;
                this.barmsg = "条码类别或长度错误，请根据颜色提示使用正确的试管！";
                this.$nextTick(() => {
                    this.$refs.txtbarsacn.focus();
                    this.$refs.txtbarsacn.select();
                });
            } else {
                this.showselinfo();
                //预制模式下,扫描的条码没有问题，如果条数过多，跳转到当前条码位置
                if (this.options.prebarcodemode == "1") {
                    this.FunScrollY(newestRowIndex, this.barmsg);
                }
                //预制模式下，勾选预制条码扫描到最后一个条码自动完成(打印条码为自动打印)
                if (this.options.prebarcodemode == "1" && this.options.cxautosavescanlast == "1") {
                    var checklists = this.curTableData.filter((t) => t.bselect && t.barcode == "");
                    if (checklists.length == 0) {
                        //自动完成
                        this.btnPrint_click();
                    } else {
                        this.barmsg = "";
                    }
                } else {
                    this.barmsg = "";
                }
            }
        },
        FunScrollY(newestRowIndex) {
            //从当前条码索引往下查找下一条需要扫描的条码
            var nextrowindex = newestRowIndex;
            for (var i = nextrowindex + 1; i < this.$refs.tbCurSample.getTableData().fullData.length; i++) {
                var newArr = this.$refs.tbCurSample.getTableData().fullData[i];
                if (newArr.bselect && newArr.endflag != "1" && newArr.premodeprt != "1") {
                    nextrowindex = i;
                    break;
                }
            }
            this.$nextTick(() => {
                let L = this.$refs.tbCurSample.getTableData().fullData[nextrowindex];
                this.$refs.tbCurSample.scrollToRow(L);
            });
        },
        barscanfocus() {
            this.$refs.txtbarsacn.focus();
            this.$refs.txtbarsacn.select();
        },
        check_barscanfocus() {
            this.$refs.check_txtbarsacn.focus();
            this.$refs.check_txtbarsacn.select();
        },
        testchange() {
            console.log("cardtype", this.options.cardtype);
        },
        getCount(i){
            var r = 1;
            if(i){
                //检测是否是数字
                var pattern = /^[0-9]*$/;
                if (pattern.test(i)) {
                    r = parseInt(i);
                }
            }
            return  r;
        },
        showselinfo() {
            this.showReqgroupna = [];
            this.itemcnt = "0项";
            this.barcnt = "0个条码";
            this.sumamount = "合计：0.00";
            if (this.curTableData && this.curTableData.length > 0) {
                let cData = this.curTableData.filter((t) => t.bselect == true && t.endflag != "1");
                let bar = [];
                var barcode_count = 0;
                this.sumam = 0;
                if (cData.length > 0) {
                    var iPosArr = [];
                    var haveShowPatinfo = '0';
                    if(this.flag_isShowInputPatinfo == 'have' || this.flag_isShowInputPatinfo_item == 'have'){
                        haveShowPatinfo = '1';
                    }
                    this.flag_isShowInputPatinfo = "no";
                    this.flag_isShowInputPatinfo_item = "no";
                    //初始化病人信息字段
                    this.plug_idcardno = '';
                    this.plug_phonenum = '';
                    this.plug_name = '';
                    this.plug_age = '';
                    this.plug_address = '';
                    this.plug_sexname = '';

                    for (let i = 0; i < cData.length; i++) {
                        let barcode = cData[i].barcode;
                        if (!!barcode) {
                            if (this.options.prebarcodemode == "1") {
                                if (bar.indexOf(barcode) == -1 && !barcode.startsWith("barcode")) {
                                    bar.push(barcode);
                                    barcode_count = barcode_count + parseInt(this.getCount(cData[i].test_tube_qty));
                                }
                            } else {
                                if (bar.indexOf(barcode) == -1) {
                                    bar.push(barcode);
                                    barcode_count = barcode_count + parseInt(this.getCount(cData[i].test_tube_qty));
                                }
                            }
                        }
                        if(this.options.popuppatphone == '1') {
                            //弹窗提示用户输入病人身份证和电话
                            if(!cData[i].pat_idcardno || !cData[i].pat_phone) {
                                //判断身份证和电话是否为空
                                this.flag_isShowInputPatinfo = "have";
                            }
                        }
                        //申请项目是否设置了采血时需补充电话、地址等信息
                        var row_itemcode = cData[i].req_itemcode + ',';
                        if(this.options.plug_items.indexOf(row_itemcode) != -1) {
                            //判断申请项目是否设置
                            this.flag_isShowInputPatinfo_item = "have";
                        }
                        //身份证号
                        if(!!cData[i].pat_idcardno && !this.plug_idcardno) {
                            this.plug_idcardno = cData[i].pat_idcardno;
                        }
                        //电话号码
                        if(!!cData[i].pat_phone && !this.plug_phonenum) {
                            this.plug_phonenum = cData[i].pat_phone;
                        }
                        //姓名
                        if(!!cData[i].pat_name && !this.plug_name) {
                            this.plug_name = cData[i].pat_name;
                        }
                        //性别
                        if(!!cData[i].pat_sexname && !this.plug_sexname) {
                            this.plug_sexname = cData[i].pat_sexname;
                        }
                        //年龄
                        if(!!cData[i].pat_agestr && !this.plug_age) {
                            this.plug_age = cData[i].pat_agestr;
                        }
                        //地址
                        if(!!cData[i].pat_address && !this.plug_address) {
                            this.plug_address = cData[i].pat_address;
                        }
                        if (this.options.cxchknochargeamt == "1") {
                            if (cData[i].charge_flag != "1") {
                                this.sumam += parseFloat(cData[i].amount);
                            }
                        } else {
                            this.sumam += parseFloat(cData[i].amount);
                        }
                        //tab页显示分单类别或条码前缀
                        if (this.options.groupshowbarhead == "1") {
                            //过滤前缀为空和前缀为create的数据
                            if (cData[i].req_barcode_head_hid && cData[i].premodeprt != "1") {
                                var cData_barcode_head = cData[i].req_barcode_head_hid; //前缀
                                if (cData[i].singletube != "1") {
                                    cData[i].singletube = "0";
                                }
                                let frow = cData[i].req_groupid + "[RM]" + cData[i].specimen_code + "[RM]" + cData[i].emer_flag + "[RM]" + cData[i].perform_dept + "[RM]" + cData[i].singletube;
                                var isAdd = 0;
                                for (let j = 0; j < cData.length; j++) {
                                    const element = cData[j];
                                    if (cData_barcode_head == element.req_barcode_head_hid && element.premodeprt != "1" && element.req_barcode_head_hid && iPosArr.indexOf(element.iPos) == -1) {
                                        if (element.singletube != "1") {
                                            element.singletube = "0";
                                        }
                                        let currow = element.req_groupid + "[RM]" + element.specimen_code + "[RM]" + element.emer_flag + "[RM]" + element.perform_dept + "[RM]" + element.singletube;
                                        if (currow == frow) {
                                            isAdd = parseInt(this.getCount(element.test_tube_qty));
                                            //满足相等的条件下，如果第二个循环中singletube为1，则第一个循环必定为独采，所以当第一个循环的iPos和第二个循环的iPos不相等时，加1
                                            if (element.singletube == "1" && element.iPos != cData[i].iPos) {
                                                isAdd= isAdd + parseInt(this.getCount(element.test_tube_qty));
                                            }
                                            iPosArr.push(element.iPos);
                                        }
                                    }
                                }
                                if (isAdd > 0) {
                                    let ishave = this.showReqgroupna.findIndex((item) => {
                                        return item.barcode_head == cData_barcode_head;
                                    });
                                    if (ishave == -1) {
                                        var lableValue = cData_barcode_head + "(" + isAdd + "管)";
                                        let tmp = {
                                            label: lableValue,
                                            cnt: isAdd,
                                            barcode_head: cData_barcode_head,
                                            background: cData[i].req_groupcolor_b,
                                            color: cData[i].req_groupcolor,
                                        };
                                        this.showReqgroupna.push(tmp);
                                    } else {
                                        //如果有，则计数加isAdd
                                        var groupcnt = this.showReqgroupna[ishave].cnt + isAdd;
                                        this.showReqgroupna[ishave].cnt = groupcnt;
                                        this.showReqgroupna[ishave].label = cData_barcode_head + "(" + groupcnt + "管)";
                                    }
                                }
                            }
                        } else {
                            //过滤分单类别为空的数据
                            if (cData[i].req_groupid) {
                                var cData_req_groupna = cData[i].req_groupna; //分单类别
                                var cData_req_groupid = cData[i].req_groupid; //分单类别id
                                var cData_req_groupcolor_b = cData[i].req_groupcolor_b; //分单颜色
                                if (cData[i].singletube != "1") {
                                    cData[i].singletube = "0";
                                }
                                let frow = cData[i].req_groupid + "[RM]" + cData[i].specimen_code + "[RM]" + cData[i].emer_flag + "[RM]" + cData[i].perform_dept + "[RM]" + cData[i].singletube;
                                var isAdd = 0;
                                var oldAddd = 0;
                                if(this.options.barcodeisorignalno == '1'){
                                    frow = cData[i].barcode + "[RM]" + cData[i].req_groupna + "[RM]" + cData[i].req_groupcolor_b;
                                }
                                for (let j = 0; j < cData.length; j++) {
                                    const element = cData[j];
                                    if(this.options.barcodeisorignalno == '1'){
                                        //使用his原始单号，必然是打印模式，不会需要统计条码前缀的管数，所以只需要在这里加即可
                                        if (cData_req_groupna == element.req_groupna && cData_req_groupcolor_b && element.req_groupcolor_b && element.req_groupid && iPosArr.indexOf(element.iPos) == -1) {
                                            if (element.singletube != "1") {
                                                element.singletube = "0";
                                            }
                                            let currow = element.barcode + "[RM]" + element.req_groupna + "[RM]" + element.req_groupcolor_b;
                                            if (currow == frow) {
                                                isAdd = parseInt(this.getCount(element.test_tube_qty));
                                                //取相同条码号下，最大的试管数量
                                                if(isAdd > oldAddd){
                                                    oldAddd = isAdd;
                                                }
                                                iPosArr.push(element.iPos);
                                            }
                                        }
                                    }
                                    else {
                                        if (cData_req_groupid == element.req_groupid && element.req_groupid && iPosArr.indexOf(element.iPos) == -1) {
                                            if (element.singletube != "1") {
                                                element.singletube = "0";
                                            }
                                            let currow = element.req_groupid + "[RM]" + element.specimen_code + "[RM]" + element.emer_flag + "[RM]" + element.perform_dept + "[RM]" + element.singletube;

                                            if (currow == frow) {
                                                isAdd = parseInt(this.getCount(element.test_tube_qty));
                                                //满足相等的条件下，如果第二个循环中singletube为1，则第一个循环必定为独采，所以当第一个循环的iPos和第二个循环的iPos不相等时，加1
                                                if (element.singletube == "1" && element.iPos != cData[i].iPos) {
                                                    isAdd= isAdd + parseInt(this.getCount(element.test_tube_qty));
                                                }
                                                iPosArr.push(element.iPos);
                                            }
                                        }
                                    }
                                }
                                if(this.options.barcodeisorignalno == '1'){
                                    isAdd = oldAddd;
                                }
                                if (isAdd > 0) {
                                    let ishave = this.showReqgroupna.findIndex((item) => {
                                        return item.req_groupid == cData_req_groupid;
                                    });
                                    if(this.options.barcodeisorignalno == '1'){
                                        ishave = this.showReqgroupna.findIndex((item) => {
                                            return item.req_groupna == cData_req_groupna && item.background == cData_req_groupcolor_b;
                                        });
                                    }
                                    if (ishave == -1) {
                                        var lableValue = cData_req_groupna + "(" + isAdd + "管)";
                                        let tmp = {
                                            label: lableValue,
                                            cnt: isAdd,
                                            req_groupna: cData_req_groupna,
                                            req_groupid: cData_req_groupid,
                                            background: cData[i].req_groupcolor_b,
                                            color: cData[i].req_groupcolor,
                                        };
                                        this.showReqgroupna.push(tmp);
                                    } else {
                                        //如果有，则计数加isAdd
                                        var groupcnt = this.showReqgroupna[ishave].cnt + isAdd;
                                        this.showReqgroupna[ishave].cnt = groupcnt;
                                        this.showReqgroupna[ishave].label = cData_req_groupna + "(" + groupcnt + "管)";
                                    }
                                }
                            }
                        }
                    }

                    if(this.flag_isShowInputPatinfo == 'have' && !this.dialogShowInputPatinfo) {
                        if(haveShowPatinfo != '1'){
                            this.dialogShowInputPatinfo = true;
                        }
                    }
                    if(this.flag_isShowInputPatinfo_item == 'have' && !this.dialogShowInputPatinfo) {
                        if(this.curr_checkrowinfo.bselect != undefined){
                            if(this.curr_checkrowinfo.bselect == true){
                                var itemcode = this.curr_checkrowinfo.req_itemcode + ',';
                                if(this.options.plug_items.indexOf(itemcode) != -1) {
                                    this.dialogShowInputPatinfo = true;
                                }
                            }
                        }
                        else{
                            this.dialogShowInputPatinfo = true;
                        }
                        this.curr_checkrowinfo = [];
                    }

                    this.itemcnt = cData.length + "项";
                    this.barcnt = barcode_count + "个条码";
                    this.sumamount = "合计：" + Math.round(this.sumam);
                }
            }
        },
        plugConfirmClick(){
            if(!this.plug_phonenum || !this.plug_idcardno){
                this.$alert("请填写身份证和电话信息！", "错误");
                return false;
            }
            //转换年龄
            var nowage = this.Str2Age(this.plug_age);
            if(isNaN(nowage)){
                this.$alert("输入年龄非法,请修改", "错误");
                return false;
            }
            //填充数据
            if (this.curTableData && this.curTableData.length > 0) {
                let cData = this.curTableData.filter((t) => t.bselect == true && t.endflag != "1");
                for (let i = 0; i < cData.length; i++){
                    var row = cData[i];
                    row.pat_idcardno = this.plug_idcardno;
                    row.pat_phone = this.plug_phonenum;
                    row.pat_name = this.plug_name;
                    row.pat_sexname = this.plug_sexname;
                    row.pat_sex = this.plug_sexname == '男' ? '1' : '2';
                    row.pat_agestr = this.plug_age;
                    //pat_ageyear需要转换
                    row.pat_ageyear = nowage;
                    row.pat_address = this.plug_address;
                }
            }
            this.dialogShowInputPatinfo = false;
        },
        Str2Age(str){
            var year = 0.0;
            var month = 0.0;
            var week = 0.0;
            var day = 0.0;
            if (!isNaN(str))
            {
                //全数字
                year = parseFloat(str);
                if (year > 0 && year < 200)
                {
                    return year;
                }
                else
                {
                    this.$alert("输入年龄非法,请修改", "错误");
                    return false;
                }
            }

            str = str.replace(/ /g, "").replace(/个月/g, "月").replace(/零/g, "").toUpperCase(); //去空格
            //逐个找岁、月、天
            var pos_y = -1;
            if(str.indexOf("年") != -1){
                pos_y = str.indexOf("年");
            }
            else if(str.indexOf("岁") != -1){
                pos_y = str.indexOf("岁");
            }
            else if(str.indexOf("Y") != -1){
                pos_y = str.indexOf("Y");
            }
            if(pos_y >= 0){
                year = parseFloat(str.substring(0, pos_y));
                str = str.substring(pos_y + 1);
                if(str.length == 0){
                    return year;
                }
            }

            var pos_m = -1;
            if(str.indexOf("月") != -1){
                pos_m = str.indexOf("月");
            }
            else if(str.indexOf("M") != -1){
                pos_m = str.indexOf("M");
            }
            if(pos_m >= 0){
                month = parseFloat(str.substring(0, pos_m));
                str = str.substring(pos_m + 1);
                if(str.length == 0){
                    return parseFloat(year + month/12).toFixed(2);
                }
            }

            var pos_w = -1;
            if(str.indexOf("周") != -1){
                pos_w = str.indexOf("周");
            }
            if(pos_w >= 0){
                week = parseInt(str.substring(0, pos_w));
                str = str.substring(pos_w + 1);
                if(str.length == 0){
                    return parseFloat(year + month/12 + week*7/365).toFixed(2);
                }
            }

            var pos_d = -1;
            if(str.indexOf("天") != -1){
                pos_d = str.indexOf("天");
            }
            else if(str.indexOf("日") != -1){
                pos_d = str.indexOf("日");
            }
            else if(str.indexOf("D") != -1){
                pos_d = str.indexOf("D");
            }
            if(pos_d >= 0){
                day = parseInt(str.substring(0, pos_d));
                str = str.substring(pos_d + 1);
                if(str.length == 0){
                    return parseFloat(year + month/12 + week*7/365 + day/365).toFixed(2);
                }
            }

            //如果上面都截取完了还有剩余字符，那就是非法的年龄了
            this.$alert("输入年龄非法,请修改", "错误");
            return false;
        },
        btnOnlyPrint_click() {},
        btnRePrint_click(btype) {
            let ptype = "2"; //打印类型 2：只打印条码 3：只打印回单
            let alertmsg = "";
            if (this.activeName == "historytab") {
                let cData = this.historyTableData.filter((t) => t.selectflag == true);
                let patname = cData[0].pat_name;
                let bcnt = cData.length;
                if (cData && cData.length > 0) {
                    if (btype == "back") {
                        bcnt = 0;
                        ptype = "3"; //只打印回单
                        let cbarno = ""; //回单号
                        for (let i = 0; i < cData.length; i++) {
                            let barcode = cData[i].collectbarcode;
                            if (cbarno.indexOf(barcode) == -1) {
                                bcnt = bcnt + 1;
                                if (cbarno == "") {
                                    cbarno = barcode;
                                } else {
                                    cbarno = cbarno + "," + barcode;
                                }
                            }
                        }
                        this.$confirm("是否要重打" + patname + "的回单（共" + bcnt + "张）?", "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            focusCancelButton: true,
                            closeOnClickModal: false,
                            type: "warning",
                        })
                            .then(() => {
                                this.printbarcode("", ptype, cbarno, "1");
                            })
                            .catch(() => {});
                    } else {
                        ptype = "2"; //只打印条码
                        let barcodes = "";
                        let selbarcode = "";
                        for (let index = 0; index < cData.length; index++) {
                            const element = cData[index];
                            barcodes += element.barcode + ",";
                            if (element.req_stat >= "4" && this.options.noprintbarcodercv == "1") {
                                selbarcode += element.barcode + ",";
                            }
                        }
                        if (selbarcode != "") {
                            this.$message.error("如下已接收标本禁止重打条码：" + selbarcode.trimEnd(","));
                            return false;
                        } else {
                            this.$tool
                                .request({
                                    url: "REQ/REQ1/REQ110",
                                    method: "post",
                                    data: {
                                        action: "checkmixbarcode",
                                        barcodes: barcodes,
                                    },
                                })
                                .then((res) => {
                                    if (res.msg != "") {
                                        this.$alert("该条码【" + res.msg + "】为混采条码，不能进行重打条码操作！", "提示");
                                        return false;
                                    } else {
                                        this.RePrintBarcodes(cData, ptype, 0);
                                    }
                                })
                                .catch((e) => {
                                    this.$message.error(e);
                                });
                        }
                        // this.$confirm("是否要重打" + patname + "的条码（共" + bcnt + "张）?", "提示", {
                        //     confirmButtonText: "确定",
                        //     cancelButtonText: "取消",
                        //     focusCancelButton: true,
                        //     closeOnClickModal: false,
                        //     type: "warning"
                        // })
                        //     .then(() => {
                        //         this.RePrintBarcodes(cData, ptype, 0);
                        //     })
                        //     .catch(() => {});
                        //this.RePrintBarcodes(cData, ptype, 0);
                    }
                } else {
                    this.$alert("至少选择一个要重打的条码！", "请选择", {
                        confirmButtonText: "确定",
                    });
                }
            } else if (this.activeName == "curtab") {
                if (this.barcodestr != "") {
                    let pbars = this.barcodestr;
                    let bcnt = 1;
                    let patname = this.curTableData[0].pat_name;
                    if (btype == "back") {
                        ptype = "3"; //只打印回单
                        alertmsg = "是否要重打" + patname + "的回单?";
                    } else {
                        ptype = "2"; //只打印条码
                        let cData = this.curTableData.filter((t) => t.bselect == true);
                        if (cData && cData.length > 0) {
                            pbars = "";
                            let loopbar = "";
                            for (let i = 0; i < cData.length; i++) {
                                if (cData[i].endflag == "1") {
                                    if (loopbar != cData[i].barcode) {
                                        loopbar = cData[i].barcode;
                                        if (pbars == "") pbars = cData[i].barcode;
                                        else pbars += "," + cData[i].barcode;
                                    }
                                }
                            }
                        }
                        bcnt = pbars.split(",").length;
                        alertmsg = "是否要重打" + patname + "的条码（共" + bcnt + "张）?";
                    }

                    this.$confirm(alertmsg, "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        focusCancelButton: true,
                        closeOnClickModal: false,
                        type: "warning",
                    })
                        .then(() => {
                            //this.printbarcode(this.barcodestr, "2", "");
                            this.printbarcode(pbars, ptype, this.cbarno, "1");
                        })
                        .catch(() => {});
                }
            }
        },
        RePrintBarcodes(cData, ptype, i) {
            if (i >= cData.length) {
                return;
            } else {
                let barcode = cData[i].barcode;
                this.$tool
                    .request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "checkbarcode",
                            barcode: barcode,
                        },
                    })
                    .then((res) => {
                        if (res.flag == "0") {
                            if (cData[i].req_stat != "1" && cData[i].req_stat != "2") {
                                this.$confirm("条码号:" + barcode + "(" + cData[i].req_groupna + ")， 状态是【" + cData[i].req_statname + "】，您是否要继续重打条码?", "提示", {
                                    confirmButtonText: "确定",
                                    cancelButtonText: "取消",
                                    focusCancelButton: true,
                                    closeOnClickModal: false,
                                    type: "warning",
                                })
                                    .then(() => {
                                        this.printbarcode(barcode, ptype, "", "1");
                                    })
                                    .catch((e) => {
                                        this.$message.error(e);
                                    });
                            } else {
                                this.printbarcode(barcode, ptype, "", "1");
                            }
                        } else this.$message.warning("已接收标本禁止重打条码！");
                    })
                    .catch((e) => {
                        this.$message.error(e);
                    });
                this.RePrintBarcodes(cData, ptype, i + 1);
            }
        },
        btnPrint_click(onlybar) {
            if ((this.options.cxnobalancemsg == "1" || this.options.cxnobalancemsg == "2") && parseFloat(this.overmoney) < this.sumam) {
                let msg = "本次采样金额不足！所需金额：" + this.sumam + "，余额：" + this.overmoney + "，差额：" + (this.sumam - this.overmoney);
                if (this.options.cxnobalancemsg == "2") {
                    this.$alert(msg, "错误");
                    return false;
                } else if (this.options.cxnobalancemsg == "1") {
                    this.$confirm(msg + "，是否继续？", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    })
                        .then(() => {
                            // 预制模式下如果开启了重复扫描预制条码
                            if (this.options.prebarcodemode == "1" && this.options.cxrechkprebarcode == "1") {
                                this.ScanBarCodeToCheck(onlybar);
                            } else {
                                this.GetAddRptItem(onlybar);
                            }
                        })
                        .catch(() => {});
                }
            } else {
                // 预制模式下如果开启了重复扫描预制条码
                if (this.options.prebarcodemode == "1" && this.options.cxrechkprebarcode == "1") {
                    this.ScanBarCodeToCheck(onlybar);
                } else {
                    this.GetAddRptItem(onlybar);
                }
            }
            //打印模式下，打印后聚焦
            if (this.options.prebarcodemode != "1") {
                this.$nextTick(() => {
                    this.$refs.txtinputno.focus();
                    this.$refs.txtinputno.select();
                });
            }
            //完成或者打印后，恢复初始设置的日期间隔，提升性能，以及采血体验
            if (this.chk_fixeddate != "1") {
                this.options.dateinterval = this.dateinterval_init;
                this.SetQueryDate();
            }
        },
        GetAddRptItem(onlybar) {
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "getAddRptItem",
                        orderinfo: this.curTableData,
                        prebarcodemode: this.options.prebarcodemode,
                    },
                })
                .then((res) => {
                    if (res.data && res.data.length > 0) {
                        if(this.options.addrptitemmustinput != '1' && this.options.hideaddrptitembox == '1'){
                            //不显示附加报告弹窗
                            this.addRptItemVisible = false;
                            this.AddaRptItemList = res.data;
                            //直接执行弹窗点击确定的方法
                            this.Print();
                        }
                        else {
                            this.addRptItemVisible = true;
                            this.AddaRptItemList = res.data;
                        }
                    } else{
                        this.Print1(onlybar);
                    }
                    if (onlybar != "2") {
                        if (this.options.cx_photographtime == "2") {
                            //打印（或绑定完成）时拍照
                            this.autoCameraTakePhoto();
                        }
                    }
                })
                .catch((e) => {
                    this.$message.error(e);
                });
        },
        ScanBarCodeToCheck(onlybar) {
            this.setOnlybar = onlybar;
            if (onlybar != "2") {
                let checklistWithoutC = this.curTableData.filter((t) => t.bselect && t.barcode != "" && t.req_barcode_head != "CREATE");
                if (checklistWithoutC.length > 0) {
                    this.popBarCodeCheckVisible = true;
                    this.$nextTick(() => {
                        this.$refs.check_txtbarsacn.focus();
                        this.$refs.check_txtbarsacn.select();
                    });
                    //处理重复，以条码为主
                    var checkData = [];
                    var haveInBarcode = "";
                    for (let index = 0; index < checklistWithoutC.length; index++) {
                        const element = checklistWithoutC[index];
                        if (haveInBarcode == element.barcode) {
                            if (checkData.length > 0) {
                                var check_length = checkData.length;
                                var reqdisplayname = checkData[check_length - 1].reqdisplayname;
                                checkData[check_length - 1].reqdisplayname = reqdisplayname + "," + element.reqdisplayname;
                            }
                        } else {
                            checkData.push(element);
                        }
                        haveInBarcode = element.barcode;
                    }
                    this.CheckBarCodeList = checkData;
                } else {
                    let checklist = this.curTableData.filter((t) => t.bselect && t.barcode != "");
                    if (checklist.length > 0) {
                        //前缀为CREATE的条码不需要重复验证
                        this.GetAddRptItem(onlybar);
                    } else {
                        this.$alert("本次没有扫描条码", "错误");
                        return false;
                    }
                }
            } else {
                this.GetAddRptItem(onlybar);
            }
        },
        CommitTips() {
            var filter = this.AddaRptItemList.filter((x) => x.value == "" || x.value == null);
            if (filter.length > 0 && this.options.addrptitemmustinput == "1") {
                this.$message.warning("附加报告项目必须全部录入！");
                this.$refs.AddaRptItemTable.setActiveCell(filter[0], "value");
                return;
            }
            var filter1 = this.AddaRptItemList.filter((x) => x.inputlower != "" && x.inputlower != null);
            var filter2 = this.AddaRptItemList.filter((x) => x.inputupper != "" && x.inputupper != null);
            if (filter1.length > 0) filter1 = filter1.filter((x) => x.value != null && x.value != "" && parseFloat(x.value) < parseFloat(x.inputlower));
            if (filter2.length > 0) filter2 = filter2.filter((x) => x.value != null && x.value != "" && parseFloat(x.value) > parseFloat(x.inputupper));
            if (filter1.length > 0) {
                this.$message.warning("附加报告项目[" + filter1[0].rpt_itemname + "]值[" + filter1[0].value + "]超出下限（" + filter1[0].inputlower + "）！");
                this.$refs.AddaRptItemTable.setActiveCell(filter1[0], "value");
                return;
            } else if (filter2.length > 0) {
                this.$message.warning("附加报告项目[" + filter2[0].rpt_itemname + "]值[" + filter2[0].value + "]超出上限（" + filter2[0].inputupper + "）！");
                this.$refs.AddaRptItemTable.setActiveCell(filter2[0], "value");
                return;
            }
            this.Print();
        },
        CancelTips() {
            if (this.options.addrptitemmustinput != "1") {
                this.Print();
                this.addRptItemVisible = false;
            } else this.addRptItemVisible = false;
        },
        Print(onlybar) {
            this.barcodestr = "";
            this.cbarno = "";
            this.prtbtndisabled = true;
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "createreqmaster",
                        orderinfo: this.curTableData,
                        prebarcodemode: this.options.prebarcodemode,
                        addrptitemlist: this.AddaRptItemList,
                        image: this.image,
                        ischange: this.ischange,
                    },
                })
                .then((res) => {
                    if (res.errmsg != "") {
                        this.$alert(res.errmsg, "错误", {
                            confirmButtonText: "确定",
                        }).then(() => {});
                        this.prtbtndisabled = false;
                        this.addRptItemVisible = false;
                    } else {
                        this.refhistory = false;
                        this.getpathistory();
                        this.addRptItemVisible = false;
                        this.barcodestr = "";
                        this.endflag = true;
                        this.prtbtndisabled = true;
                        this.reprtbtndisabled = false;
                        this.camerabtndisabled = false;
                        this.inputno = "";
                        this.patname = "";
                        this.$refs.txtinputno.focus();
                        this.$refs.txtinputno.select();
                        if (this.options.prebarcodemode == "1") {
                            //预置条码模式
                            this.txtinputnodisabled = false;
                            this.barscandisabled = true;
                            this.barmsg = "本次完成 " + res.barcnt + " 份标本采样";
                            //聚焦
                            this.$nextTick(() => {
                                this.$refs.txtinputno.focus();
                                this.$refs.txtinputno.select();
                            });
                        }
                        //预制条码模式下也有的分单类别需要打印条码
                        this.setbarcode(res);
                        // 检验是否执行混采
                        if (this.options.isenablemix == "1") {
                            this.domixedsampling();
                        }
                        if (this.options.cx_collectinfotxt == "1") {
                            if (typeof jsObj != "undefined") {
                                let retstr = jsObj.ReadCard("savef:" + res.cbarno);
                            }
                        }
                        //先把明细的条码打印掉，再来处理混采， 打印是调用壳的，是个阻塞程序，所以放在混采api调用之后
                        if (!this.IsPrintBarcode) this.printbarcode(this.barcodestr, onlybar, res.cbarno, "0");
                        let cdt = res.create_dt;
                        this.setsampleddata(cdt);
                        this.historycolor = true; //"red";
                        if(res.othermsg != "") {
                            this.$message.info(res.othermsg);
                        }
                    }
                })
                .catch((e) => {
                    this.$alert("条码生成超时！请检查HIS系统和HIS接口是否正常！", "错误", {
                        confirmButtonText: "确定",
                    }).then(() => {});
                    this.prtbtndisabled = false;
                    this.addRptItemVisible = false;
                });
        },
        // 条码设值
        setbarcode(res) {
            let pbars = [];
            this.curTableData.forEach((e) => {
                if (res.dic[e.iPos] != null) {
                    e.barcode = res.dic[e.iPos];
                    if (pbars.indexOf(e.barcode) == -1) {
                        if (res.printcnt) {
                            let pc = res.printcnt.find((t) => t.barcode == e.barcode);
                            if (pc) {
                                for (let i = 0; i < pc.pcnt; i++) {
                                    pbars.push(e.barcode);
                                }
                            }
                        } else {
                            pbars.push(e.barcode);
                        }
                    }
                    // if (this.barcodestr == "") this.barcodestr = e.barcode;
                    // else this.barcodestr += "," + e.barcode;
                    e.endflag = "1";
                }
            });
            this.cbarno = res.cbarno;
            pbars.forEach((e) => {
                if (this.barcodestr == "") this.barcodestr = e;
                else this.barcodestr += "," + e;
            });
        },
        BeforeCloseDialogpremixbarcode() {
            this.$confirm("还未扫描混样试管码，确定要关闭吗？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                focusCancelButton: true,
                closeOnClickModal: false,
                type: "warning",
            })
                .then(() => {
                    this.$refs.refdialogpremixbarcode.Cancel();
                })
                .catch(() => {});
        },
        ColumnClassName({ seq, row, rowIndex, $rowIndex, column }) {
            if (column.property == "trans_type") {
                if (row.trans_type == "报告日志" || row.trans_type=="无纸化") return "reportlogclass";
            }
        },
        opendialogpremixbar() {
            this.premixprebarcode = "";
            this.$refs.refpremixbar.focus();
        },
        dialogpremixbarcodeClosed() {
            this.$refs.refdialogpremixbarcode.Cancel();
        },
        async premixbarsacn() {
            this.premixprebarcode = this.premixprebarcode.toString().trim();
            if (this.premixprebarcode == "") {
                this.$alert("请扫描混样试管码！");
                this.$refs.refpremixbar.focus();
            } else {
                var barcode = await this.$pub.BarcodeTrans(this.premixprebarcode);
                this.premixprebarcode = barcode.toString();
                var starthead = this.premixheader;
                if(this.premixheader.indexOf(',') != -1 ){
                    //包含逗号，说明需要兼容多种条码前缀
                    var headArr = this.premixheader.split(',');
                    headArr.forEach(element => {
                            if(this.premixprebarcode.startsWith(element)){
                                starthead = element;
                            }
                        });
                }
                var barcodelength = parseInt(this.premixlen);
                if(barcodelength == NaN){
                    barcodelength = 0;
                }
                if(this.premixlen.indexOf(',') != -1){
                    //包含逗号，说明需要兼容多种条码长度
                    var lengthArr = this.premixlen.split(',');
                    lengthArr.forEach(element => {
                        if(this.barmsg.length == parseInt(element)){
                            barcodelength = parseInt(element);
                        }
                    });
                }
                if (this.premixprebarcode.startsWith(starthead) && this.premixprebarcode.length == barcodelength) {
                    //调用后台校验条码号是否合法
                    this.$tool
                        .request({
                            url: "REQ/REQ1/REQ110",
                            method: "post",
                            data: {
                                action: "checkprebarcode",
                                barcode: this.premixprebarcode,
                            },
                        })
                        .then((res) => {
                            if (res.flag == "1") {
                                this.$refs.refdialogpremixbarcode.Confirm();
                                this.mixprebarcode = this.premixprebarcode;
                                this.Print1(this.setOnlybar);
                            } else {
                                this.$alert(res.msg);
                                this.$refs.refpremixbar.focus();
                                this.$refs.refpremixbar.select();
                            }
                        })
                        .catch((e) => {
                            this.$alert("校验条码合法性过程中发生异常");
                            this.$refs.refpremixbar.focus();
                            this.$refs.refpremixbar.select();
                        });
                } else {
                    this.$alert("试管码前缀或长度不匹配，请重新扫描");
                    this.$refs.refpremixbar.focus();
                    this.$refs.refpremixbar.select();
                }
            }
        },
        // 混采放在后台一块处理，打印(完成)处理方法
        async Print1(onlybar) {
            this.barcodestr = "";
            this.cbarno = "";
            this.prtbtndisabled = true;
             // 控制 混样完全后，及时清理页面数据
            if (this.mix_cnt != "0" && this.mix_cnt == this.mixTableData.length) {
                this.mix_itemcode = "";
                this.mixTableData = [];
                this.mixprebarcode = "";
                localStorage.removeItem("lastmixbarno");
                this.mix_cnt = "0";
                this.mix_barcode = "";
            }
            this.setOnlybar = onlybar;
            //当前操作的混样主条码为空，表示开启一次新的混样，并且设置了混样条码使用预制模式的情况，要弹窗扫描主条码试管条码
            var dlist = this.curTableData.filter((t) => t.bselect == true && t.mixnum > 0);
            //增加判断所选的医嘱中，是否包含混样条码，只有包含混样条码，才需要再次扫描主条码试管条码
            if (dlist.length > 0 && this.mixprebarcode == "" && this.options.local_premixbar == "1") {
                this.premixprebarcode = "";
                try {
                    let row = dlist[0];
                    this.premixheader = row.req_barcode_head_hid;
                    this.premixlen = row.req_barcode_length;
                    await this.$refs.refdialogpremixbarcode.ShowDialog();
                } catch (e) {
                    //没有扫描试管码时直接返回
                    this.$alert("未正确扫描混样试管码，取消本次混样！");
                    return;
                }
            } else {
            this.premixprebarcode = "";
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "createreqmaster1",
                        orderinfo: this.curTableData,
                        prebarcodemode: this.options.prebarcodemode,
                        addrptitemlist: this.AddaRptItemList,
                        image: this.image,
                        ischange: this.ischange,
                        mix_itemcode: this.mix_itemcode,
                        mixprebarcode: this.mixprebarcode,
                        mix_cnt: this.mix_cnt,
                        premixprebarcode: this.premixprebarcode,
                    },
                })
                .then((res) => {
                    if (res.errmsg != "") {
                        // this.$alert(res.errmsg, "错误", {
                        //     confirmButtonText: "确定",
                        // }).then(() => {});
                        this.prtbtndisabled = false;
                        this.addRptItemVisible = false;
                        this.mix_barcode = "";
                        this.$message.error(res.errmsg);
                    } else {
                        this.refhistory = false;
                        this.getpathistory();
                        this.addRptItemVisible = false;
                        this.barcodestr = "";
                        this.endflag = true;
                        this.prtbtndisabled = true;
                        this.reprtbtndisabled = false;
                        this.camerabtndisabled = false;
                        this.inputno = "";
                        this.patname = "";
                        this.$refs.txtinputno.focus();
                        this.$refs.txtinputno.select();
                        if (this.options.prebarcodemode == "1") {
                            //预置条码模式
                            this.txtinputnodisabled = false;
                            this.barscandisabled = true;
                            this.barmsg = "本次完成 " + res.barcnt + " 份标本采样";
                            //聚焦
                            this.$nextTick(() => {
                                this.$refs.txtinputno.focus();
                                this.$refs.txtinputno.select();
                            });
                        }
                        //预制条码模式下也有的分单类别需要打印条码
                        this.setbarcode(res);
                         // 混采成功
                        this.mixTableData = res.data;
                        this.mixprebarcode = res.mixprebarcode;
                        this.mix_cnt = res.mix_cnt;
                        this.mix_itemcode = res.mix_itemcode;
                        this.mix_barcode = res.mixdetailbarcode;
                        this.$nextTick(() => {
                            if(this.mixTableData.length > 0){
                                this.$refs.mixTable.setCurrentRow(this.mixTableData[0]);
                            }
                        });

                        if (res.isPrint == "1") {
                            //prtbarcode += this.mixprebarcode;
                            //打印混采条码，优先使用本地设置里面的科内条码样式
                            if (!this.options.mixbarstyleid) {
                                this.$pub.message(this, "没有维护条码样式", "warning");
                            } else {
                                var printcnt = this.options.mixprintcount;
                                for (var i = 0; i < printcnt; i++) {
                                    this.$pub.printbarcode(this, res.mixprebarcode, "1", this.options.mixbarstyleid, "");
                                }
                            }
                        }
                        localStorage.setItem("lastmixbarno", res.mixprebarcode);
                        // console.info("prtbarcode===" + prtbarcode);
                        if (res.isfinish == "1" &&   this.mixprebarcode != '' && this.mixTableData.length >0) {
                            localStorage.removeItem("lastmixbarno");
                            this.$alert("该混样条码号【" + this.mixprebarcode + "】混样完成，明细共计【" + this.mixTableData.length + "】条，请及时处理" , "完成", {
                                confirmButtonText: "确定",
                            }).then(() => {
                                this.mix_itemcode = "";
                                this.mixTableData = [];
                                this.mixprebarcode = "";
                                this.mix_cnt = "0";
                                this.mix_barcode = "";
                                this.inhosbarcode = "";
                            });
                        }
                        if (this.options.cx_collectinfotxt == "1") {
                            if (typeof jsObj != "undefined") {
                                let retstr = jsObj.ReadCard("savef:" + res.cbarno);
                            }
                        }
                        //先把明细的条码打印掉，再来处理混采， 打印是调用壳的，是个阻塞程序，所以放在混采api调用之后
                        if (!this.IsPrintBarcode) {//判断是否勾选了本地暂不打印条码标签，与页面是否勾选仅生成条码不打印
                            this.printbarcode(this.barcodestr, onlybar, res.cbarno, "0");
                        }
                        else {
                            //勾选本地暂不打印条码标签或勾选了仅生成条码不打印，但仍需判断是否打印回单
                            if(this.bPrintBackBill){
                                this.printbackbarFunc(res.cbarno);
                            }
                        }
                        let cdt = res.create_dt;
                        this.setsampleddata(cdt);
                        this.historycolor = true; //"red";
                        if(res.othermsg != "") {
                            this.$message.info(res.othermsg);
                        }
                        if(this.options.cxokdelcurrent == '1'){
                            //完成后就从当前采样中删除
                            if(this.options.prebarcodemode == "1")
                            {
                                //预制模式
                                this.curTableData.forEach(e => {
                                    if(e.endflag == '1'){
                                        e.isShow = "1";
                                    }
                                });
                            }
                            else {
                                //打印模式
                                this.curTableData.forEach(e => {
                                    if(e.bselect == true){
                                        e.isShow = "1";
                                    }
                                });
                            }
                        }
                    }
                })
                .catch((e) => {
                    this.$alert("条码生成超时！请检查HIS系统和HIS接口是否正常！", "错误", {
                        confirmButtonText: "确定",
                    }).then(() => {});
                    this.prtbtndisabled = false;
                    this.addRptItemVisible = false;
                });
            }
        },

        // 做混合采样
        async domixedsampling() {
            // 控制 混样完全后，及时清理页面数据
            if (this.mix_cnt != "0" && this.mix_cnt == this.mixTableData.length) {
                this.mix_itemcode = "";
                this.mixTableData = [];
                this.mixprebarcode = "";
                localStorage.removeItem("lastmixbarno");
                this.mix_cnt = "0";
                this.mix_barcode = "";
            }
            this.premixprebarcode = "";
            // 执行混采
            var dlist = this.curTableData.filter((t) => t.bselect == true && t.mixnum > 0);
            if (!dlist || dlist.length == 0) {
                //this.$alert("混样失败：获取本次生成的条码失败！");
                return;
            }
            //当前操作的混样主条码为空，表示开启一次新的混样，并且设置了混样条码使用预制模式的情况，要弹窗扫描主条码试管条码
            if (this.mixprebarcode == "" && this.options.local_premixbar == "1") {
                try {
                    let row = dlist[0];
                    this.premixheader = row.req_barcode_head_hid;
                    this.premixlen = row.req_barcode_length;
                    await this.$refs.refdialogpremixbarcode.ShowDialog();
                } catch (e) {
                    //没有扫描试管码时直接返回
                    this.$alert("未正确扫描混样试管码，取消本次混样！");
                    return;
                }
            }

            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "executemix",
                        detailist: dlist,
                        mix_itemcode: this.mix_itemcode,
                        mixprebarcode: this.mixprebarcode,
                        mix_cnt: this.mix_cnt,
                        // prebarcodemode: this.prebarcodemode,
                        premixprebarcode: this.premixprebarcode,
                    },
                })
                .then((res) => {
                    if (res.flag == "1") {
                        // 混采成功
                        this.mixTableData = res.data;
                        this.mixprebarcode = res.mixprebarcode;
                        this.mix_cnt = res.mix_cnt;
                        this.mix_itemcode = res.mix_itemcode;
                        this.mix_barcode = res.mixdetailbarcode;
                        this.$nextTick(() => {
                            this.$refs.mixTable.setCurrentRow(this.mixTableData[0]);
                        });

                        // console(res.isPrint);
                        if (res.isPrint == "1") {
                            //prtbarcode += this.mixprebarcode;
                            //打印混采条码，优先使用本地设置里面的科内条码样式
                            if (!this.options.mixbarstyleid) {
                                this.$pub.message(this, "没有维护条码样式", "warning");
                            } else {
                                var printcnt = this.options.mixprintcount;
                                for (var i = 0; i < printcnt; i++) {
                                    this.$pub.printbarcode(this, res.mixprebarcode, "1", this.options.mixbarstyleid, "");
                                }
                            }
                        }
                        localStorage.setItem("lastmixbarno", res.mixprebarcode);
                        // console.info("prtbarcode===" + prtbarcode);
                        if (res.isfinish == "1") {
                            localStorage.removeItem("lastmixbarno");
                            this.$alert("该混样条码号【" + this.mixprebarcode + "】混样完成，明细共计【" + this.mixTableData.length + "】条，请及时处理" + res.msg, "完成", {
                                confirmButtonText: "确定",
                            }).then(() => {
                                this.mix_itemcode = "";
                                this.mixTableData = [];
                                this.mixprebarcode = "";
                                this.mix_cnt = "0";
                                this.mix_barcode = "";
                                this.inhosbarcode = "";
                            });
                        }
                    } else {
                        this.mix_barcode = "";
                        this.$message.error(res.msg);
                        // 没有混采的 就正常打印 前面主方法里已经处理过打印了
                        //if (!this.IsPrintBarcode) this.printbarcode(this.barcodestr, onlybar, res.cbarno, "0");
                    }
                })
                .catch((e) => {});
        },
        indexMethod({ rowIndex }){
            var maxindex = this.mixTableData.length;
            var index = parseInt(maxindex) - rowIndex;
            return index;
        },
        // 住院条码混样
        async inhosmixedsampling() {
            //防止数据并发
            this.txtinhosbarcodedisabled = true;
            // 控制 混样完全后，及时清理页面数据
            if (this.mix_cnt != "0" && this.mix_cnt == this.mixTableData.length) {
                this.mix_itemcode = "";
                this.mixTableData = [];
                this.mixprebarcode = "";
                localStorage.removeItem("lastmixbarno");
                this.mix_cnt = "0";
                this.mix_barcode = "";
            }
            this.premixprebarcode = "";
            // 查询存在可混样的明细 跟 可预置条码头跟长度
            const res = await this.$tool.request({
                url: "REQ/REQ1/REQ110",
                method: "post",
                data: {
                    action: "getreqdetail",
                    barcode: this.inhosbarcode,
                },
            });
            if (res.flag < 0) {
                this.$message(res.msg);
                this.txtinhosbarcodedisabled = false;
                this.$nextTick(() => {
                    this.$refs.inhosbarcode.focus();
                    this.$refs.inhosbarcode.select();
                });
                return;
            }
            if (res.data.length == 0) {
                this.$message("无需混样明细！");
                this.txtinhosbarcodedisabled = false;
                this.$nextTick(() => {
                    this.$refs.inhosbarcode.focus();
                    this.$refs.inhosbarcode.select();
                });
                return;
            }
            var dlist = res.data;
            //当前操作的混样主条码为空，表示开启一次新的混样，并且设置了混样条码使用预制模式的情况，要弹窗扫描主条码试管条码
            if (this.mixprebarcode == "" && this.options.local_premixbar == "1") {
                try {
                    let row = dlist[0];
                    if (res.premixheader == "") {
                        this.txtinhosbarcodedisabled = false;
                        this.$alert("请维护预制条码起始字符！");
                        return;
                    }
                    if (res.premixlen == "") {
                        this.txtinhosbarcodedisabled = false;
                        this.$alert("请维护预制条码长度！");
                        return;
                    }
                    this.premixheader = res.premixheader;
                    this.premixlen = res.premixlen;
                    this.txtinhosbarcodedisabled = false;
                    this.$nextTick(() => {
                    this.$refs.inhosbarcode.focus();
                    this.$refs.inhosbarcode.select();
                    });
                    await this.$refs.refdialogpremixbarcode.ShowDialog();
                } catch (e) {
                    //没有扫描试管码时直接返回
                    this.txtinhosbarcodedisabled = false;
                    this.$nextTick(() => {
                    this.$refs.inhosbarcode.focus();
                    this.$refs.inhosbarcode.select();
                    });
                    this.$alert("未正确扫描混样试管码，取消本次混样！");
                    return;
                }
            }
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "executemix",
                        detailist: dlist,
                        mix_itemcode: this.mix_itemcode,
                        mixprebarcode: this.mixprebarcode,
                        mix_cnt: this.mix_cnt,
                        // prebarcodemode: this.prebarcodemode,
                        premixprebarcode: this.premixprebarcode,
                    },
                })
                .then((res) => {
                    if (res.flag == "1") {
                        // 混采成功
                        this.inhosbarcode = "";
                        this.$nextTick(() => {
                            this.$refs.inhosbarcode.focus();
                        });
                        //更新混样主条码包含明细条码的数量
                        this.$tool
                            .request({
                                    url: "REQ/REQ1/REQ110",
                                    method: "post",
                                    data: {
                                        action: "updatemixnum",
                                        mixbarcode: res.mixprebarcode,
                                    },
                            })
                            .then((response) => {
                                if (response.flag == "-1") {
                                    this.$pub.message(this, response.msg, "warning");
                                }
                                else{
                                    this.mixTableData = res.data;
                                    this.mixprebarcode = res.mixprebarcode;
                                    this.mix_cnt = res.mix_cnt;
                                    this.mix_itemcode = res.mix_itemcode;
                                    this.mix_barcode = res.mixdetailbarcode;
                                    this.$nextTick(() => {
                                        this.$refs.mixTable.setCurrentRow(this.mixTableData[0]);
                                    });
                                    if (res.isPrint == "1") {
                                        //prtbarcode += this.mixprebarcode;
                                        //打印混采条码，优先使用本地设置里面的科内条码样式
                                        if (!this.options.mixbarstyleid) {
                                            this.$pub.message(this, "没有维护条码样式", "warning");
                                        } else {
                                            var printcnt = this.options.mixprintcount;
                                            console.info("printcnt=====" + printcnt);
                                            for (var i = 0; i < printcnt; i++) {
                                                this.$pub.printbarcode(this, res.mixprebarcode, "1", this.options.mixbarstyleid, "");
                                            }
                                        }
                                    }
                                    localStorage.setItem("lastmixbarno", res.mixprebarcode);
                                    // console.info("prtbarcode===" + prtbarcode);
                                    if (res.isfinish == "1") {
                                        localStorage.removeItem("lastmixbarno");
                                        this.$alert("该混样条码号【" + this.mixprebarcode + "】混样完成，明细共计【" + this.mixTableData.length + "】条，请及时处理" + res.msg, "完成", {
                                            confirmButtonText: "确定",
                                        }).then(() => {
                                            this.mix_itemcode = "";
                                            this.mixTableData = [];
                                            this.mixprebarcode = "";
                                            this.mix_cnt = "0";
                                            this.mix_barcode = "";
                                            this.inhosbarcode = "";
                                        });
                                    }
                                }
                            })
                    } else {
                        this.mix_barcode = "";
                        this.$message.error(res.msg);
                        this.inhosbarcode = "";
                        // 没有混采的 就正常打印 前面主方法里已经处理过打印了
                        //if (!this.IsPrintBarcode) this.printbarcode(this.barcodestr, onlybar, res.cbarno, "0");
                    }
                    this.txtinhosbarcodedisabled = false;
                    this.$nextTick(() => {
                    this.$refs.inhosbarcode.focus();
                    this.$refs.inhosbarcode.select();
                    });
                })
                .catch((e) => {});
        },

        getsampleddata() {
            var myDate = new Date();
            var today = myDate.toLocaleDateString(); //获取当前日期

            var curdate = localStorage.getItem("curdate");
            if (curdate != today) {
                localStorage.setItem("curdate", today);
                localStorage.removeItem("req110spd");
            }
            if (!this.sampleddata || this.sampleddata.length == 0) {
                try {
                    this.sampleddata = JSON.parse(localStorage.getItem("req110spd"));
                } catch (e) {
                    this.sampleddata = [];
                }
            }
        },
        setsampleddata(cdt) {
            try {
                let cData = this.curTableData.filter((t) => t.bselect == true);
                if (cData && cData.length > 0) {
                    let nss = "";
                    for (let i = 0; i < cData.length; i++) {
                        if (!cData[i].barcode.startsWith("barcode")) {
                            let ns = cData[i].req_itemname;
                            if (nss == "") {
                                nss = ns;
                            } else {
                                nss = nss + "," + ns;
                            }
                        }
                    }
                    if (!this.sampleddata) {
                        this.sampleddata = [];
                    }
                    this.sampleddata.splice(0,0,{
                        create_dt: cdt,
                        pat_no: cData[0].pat_no,
                        pat_name: cData[0].pat_name,
                        pat_sexname: cData[0].pat_sexname,
                        pat_agestr: cData[0].pat_agestr,
                        items: nss,
                        pat_diag: cData[0].pat_diag,
                        pat_phone: cData[0].pat_phone,
                        pat_id: cData[0].pat_id,
                    });
                    //localStorage.removeItem("req110spd");

                    localStorage.setItem("req110spd", JSON.stringify(this.sampleddata));
                }
            } catch (e) {}
        },
        btnCancel_click() {
            this.cancelreqcheck();
            // 不需要后台check了，前面判断同一个master_barcode的一起选择
        },
        cancelreqcheck() {
            let cData = this.historyTableData.filter((t) => t.selectflag == true);
            if (cData && cData.length > 0) {
                this.$confirm("本次共选择了【" + cData.length + "】个条码，确定要取消采样吗？", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                })
                    .then(() => {
                        for (let i = 0; i < cData.length; i++) {
                            let barcode = cData[i].barcode;
                            this.cancelreq(barcode, cData[i]);
                        }
                    })
                    .catch(() => {
                        //
                    });
            } else {
                this.$alert("至少选择一个要作废的条码！", "请选择", {
                    confirmButtonText: "确定",
                });
            }
        },
        cancelreq(barcode, row) {
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "cancelreq",
                        barcode: barcode,
                    },
                })
                .then((res) => {
                    if (res.flag == "1") {
                        row.req_stat = "9";
                        row.req_statname = "作废/取消";
                        row.selectflag = false;
                        if(res.ishismix == "1"){
                            if (res.mixcnt == "0") {
                                if(!!res.mixbarcode){
                                    this.$confirm("该条码【" + barcode + "】的混样主条码【"+ res.mixbarcode +"】已没有明细，是否需要作废？", {
                                        confirmButtonText: "确定",
                                        cancelButtonText: "取消",
                                        type: "warning",
                                        closeOnClickModal:false,
                                    }).then(() => {
                                        this.$tool
                                            .request({
                                                url: "REQ/REQ1/REQ110",
                                                method: "post",
                                                data: {
                                                    action: "cancelmixreq",
                                                    barcode: res.mixbarcode,
                                                },
                                            })
                                            .then((res) => {
                                                if (res.flag == "1") {
                                                    this.$message.success("混样条码作废成功！");
                                                    this.mixprebarcode = "";
                                                }
                                            });
                                    });
                                }
                            }
                        }
                        if(!!res.msg){
                            this.$alert("条码号[" + barcode + "]，" + res.msg, "提示", {
                                confirmButtonText: "确定",
                            });
                        }
                    } else {
                        this.$alert("条码号[" + barcode + "]作废失败，" + res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {});
        },
        inputnogetfocus() {
            this.$refs.txtinputno.select();
        },
        printbarcode(barcodestr, onlybar, cbarno, isreprt) {
            //当条码和回单都打印才会生效
            if (onlybar != "2" && onlybar != "3" && this.bPrintBackBill) {
                if (!this.options.cx_barcodebackrptorder) {
                    this.options.cx_barcodebackrptorder = "1:条码,2:回执单";
                }
                if (this.options.cx_barcodebackrptorder.indexOf(",") != -1) {
                    var barcodebackrptorderArr = this.options.cx_barcodebackrptorder.split(",");
                    if (barcodebackrptorderArr.length > 0) {
                        //判断第一个打印什么
                        if (barcodebackrptorderArr[0].indexOf("条码") != -1) {
                            //打印条码
                            this.printbarcodeFunc(barcodestr, onlybar, cbarno, isreprt);
                        } else if (barcodebackrptorderArr[0].indexOf("回执单") != -1) {
                            //打印回执单
                            this.printbackbarFunc(cbarno);
                        }
                        //为了按顺序执行，用setTimeout延迟
                        setTimeout(() => {
                            //判断第二个打印什么
                            if (barcodebackrptorderArr[1].indexOf("条码") != -1) {
                                //打印条码
                                this.printbarcodeFunc(barcodestr, onlybar, cbarno, isreprt);
                            } else if (barcodebackrptorderArr[1].indexOf("回执单") != -1) {
                                //打印回执单
                                this.printbackbarFunc(cbarno);
                            }
                        }, 500);
                    }
                }
            } else {
                //onlybar  2: 只打印条码 3：只打印回单 其余=都打印
                if (onlybar != "3") {
                    //打印条码
                    this.printbarcodeFunc(barcodestr, onlybar, cbarno, isreprt);
                }

                if (this.bPrintBackBill || onlybar == "3") {
                    if (onlybar != "2") {
                        //打印回执单
                        this.printbackbarFunc(cbarno);
                    }
                }
            }
        },
        printbarcodeFunc(barcodestr, onlybar, cbarno, isreprt) {
            //打印条码
            if (barcodestr != null && barcodestr != "") {
                if (this.options.barcodestyle != "") {
                    this.$pub.printbarcode(this, barcodestr, "1", this.options.barcodestyle, this.options.cxbarcodeprinter, isreprt);
                } else {
                    this.$alert("没有设置条码的打印样式", "错误", {
                        confirmButtonText: "确定",
                    });
                }
            }
        },
        printbackbarFunc(cbarno) {
            //打印回执单
            if (this.options.cx_backrpt_style != "") {
                if (cbarno.indexOf(",") > -1) {
                    cbarno.split(",").forEach((item) => {
                        if (item != "") {
                            this.$pub.printbackbar(this, item, "1", this.options.cx_backrpt_style, this.options.backbarmode, this.options.cx_backrrintername);
                        }
                    });
                } else {
                    this.$pub.printbackbar(this, cbarno, "1", this.options.cx_backrpt_style, this.options.backbarmode, this.options.cx_backrrintername);
                }
            } else {
                this.$alert("没有设置回执单的打印样式", "错误", {
                    confirmButtonText: "确定",
                });
            }
        },
        queryhistorymixbarcode() {
            // 根据输入的混样条码，查询混样数据
            this.querymixbarcode = "";
            this.dialogquerymixVisible = true;
            setTimeout(() => {
                this.$refs.querybarcode.focus();
            }, 300);
        },
        btnmixqueryok() {
            if(this.querymixbarcode != ""){
                this.queryMixDetail(this.querymixbarcode);
            }
        },
        queryMixDetail(mixbarcode) {
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "querymixdata",
                        mixbarcode: mixbarcode,
                    },
                })
                .then((res) => {
                    if (res.flag == "1") {
                        this.dialogquerymixVisible = false;
                        this.mix_itemcode = res.mix_itemcode;
                        this.mix_cnt = res.mix_cnt;
                        this.mixprebarcode = mixbarcode;
                        this.mixTableData = res.data;
                        this.mix_barcode = "";
                    } else {
                        this.querymixbarcode = "";
                        this.$message.error(res.msg);
                        this.$refs.querybarcode.focus();
                    }
                })
                .catch((e) => {});
        },
        btnmixquerycancel() {
            this.dialogquerymixVisible = false;
        },
        mixfinish() {
            if (this.mixprebarcode) {
                this.$alert("该混样条码号【" + this.mixprebarcode + "】混样完成，，明细共计【" + this.mixTableData.length + "】条，请及时处理", "完成").then(() => {
                    if (this.options.autoprintmixbarcode == "2") {
                        //扫描最后一个条码时打印
                        if (!this.options.mixbarstyleid) {
                            this.$pub.message(this, "没有维护条码样式", "warning");
                        } else {
                            var printcnt = this.options.mixprintcount;
                            for (var i = 0; i < printcnt; i++) {
                                this.$pub.printbarcode(this, this.mixprebarcode, "1", this.options.mixbarstyleid, "");
                            }
                        }
                    }
                    localStorage.removeItem("lastmixbarno");
                    this.inhosbarcode = "";
                    this.mix_itemcode = "";
                    this.mixTableData = [];
                    this.mixprebarcode = "";
                    this.mix_cnt = "0";
                    this.mix_barcode = "";

                    //更新混样主条码包含明细条码的数量
                    const res = this.$tool.request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "updatemixnum",
                            barcode: this.mixprebarcode,
                        },
                    });
                });
            }
        },
        // 删除混样明细
        removedetailEvent(row) {
            this.dialogdeleteVisible = true;
            this.deleterow = row;
            this.deletename = row.pat_name;
        },
        btnmixdeleteok() {
            let row = this.deleterow;
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "cancelreq",
                        barcode: row.barcode,
                        mixbarcode: this.mixprebarcode,
                    },
                })
                .then((res) => {
                    if (res.flag == "1") {
                        row.req_stat = "9";
                        row.req_statname = "作废/取消";
                        row.selectflag = false;
                        this.dealmixdetail(row);
                    } else {
                        this.$alert("条码号[" + barcode + "]作废失败，" + res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {});
        },
        btnmixdeletecancel() {
            this.dealmixdetail(this.deleterow);
        },
        dealmixdetail(row) {
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "dealmixdetail",
                        barcode: row.barcode,
                        mixbarcode: row.mixbarcode,
                    },
                })
                .then((res) => {
                    if (res.flag == "1") {
                        this.dialogdeleteVisible = false;
                        this.mixTableData = res.data;
                        //更新混样主条码包含明细条码的数量
                        this.$tool
                            .request({
                                    url: "REQ/REQ1/REQ110",
                                    method: "post",
                                    data: {
                                        action: "updatemixnum",
                                        mixbarcode: row.mixbarcode,
                                    },
                            })
                            .then((response) => {
                                if (response.flag == "-1") {
                                    this.$pub.message(this, response.msg, "warning");
                                }
                                else{
                                    if (response.mixcnt == "0") {
                                        this.$confirm("该混样条码【" + this.mixprebarcode + "】已没有明细，是否需要作废？", {
                                            confirmButtonText: "确定",
                                            cancelButtonText: "取消",
                                            type: "warning",
                                        }).then(() => {
                                            this.$tool
                                                .request({
                                                    url: "REQ/REQ1/REQ110",
                                                    method: "post",
                                                    data: {
                                                        action: "cancelmixreq",
                                                        barcode: this.mixprebarcode,
                                                    },
                                                })
                                                .then((res) => {
                                                    if (res.flag == "1") {
                                                        this.$message.success("混样明细作废成功！");
                                                        this.mixprebarcode = "";
                                                        localStorage.removeItem("lastmixbarno");
                                                    }
                                                });
                                            });
                                    }
                                }
                            })
                    } else {
                        this.dialogdeleteVisible = false;
                        this.$alert("条码号[" + barcode + "]删除失败，" + res.msg, "错误", {
                            confirmButtonText: "确定",
                        });
                    }
                })
                .catch((e) => {});
        },
        btnmixcancel() {
            this.dialogdeleteVisible = false;
        },
        mixbarcodecancel() {
            this.$confirm("是否确定要作废当前混样条码？", "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            focusCancelButton: true,
                            closeOnClickModal: false,
                            type: "warning",
            })
            .then(() => {
                this.$tool
                .request({
                        url: "REQ/REQ1/REQ110",
                        method: "post",
                        data: {
                            action: "cancelmixbarcode",
                            mixmainbarcode: this.mixprebarcode,
                        },
                    })
                    .then((res) => {
                        if (res.flag == "1") {
                            this.$message.success("混样条码作废成功！");
                            this.mixprebarcode = "";
                            localStorage.removeItem("lastmixbarno");
                            this.mixTableData=[];
                        }
                        else{
                            this.$alert(res.msg, "错误", { confirmButtonText: "确定",});
                        }
                    });
            })
            .catch(() => {});
        },
        btnCamera_click() {
            if (typeof jsObj != "undefined") {
                //jsObj.AsyncCall("入参");  js这边就这样调用
                var s = jsObj.AsyncCall("callexe:ImageCatch.exe");
            } else {
                that.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                    confirmButtonText: "确定",
                });
            }
        },
        autoCameraTakePhoto() {
            if (typeof jsObj != "undefined") {
                var s = jsObj.AsyncCall("callexe:ImageCatch.exe");
                var p = jsObj.ReadCard("imgcatch:");
            } else {
                that.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                    confirmButtonText: "确定",
                });
            }
        },
        imagecatch(imgbase64) {
            var imgedata = "data:image/png;base64," + imgbase64;
            this.ImageUpload(imgedata);
        },
        ImageUpload(imagedata) {
            let cData = this.curTableData.filter((t) => t.bselect == true);
            if (cData.length == 0) {
                this.$alert("请勾选要拍照的条码号", "错误", {
                    confirmButtonText: "确定",
                });
            }
            let collectbarcodes = "";
            let barcodestr = "";
            for (let i = 0; i < cData.length; i++) {
                barcodestr += cData[i].barcode + ",";
            }
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ110",
                    method: "post",
                    data: {
                        action: "saveimage",
                        imagedata: imagedata,
                        barcodes: barcodestr,
                    },
                })
                .then((res) => {
                    if (res != "") {
                        this.$alert(res);
                    } else {
                        this.$message.success("图片保存成功！");
                    }
                });
        },
        // 合并分单类别单元格
        rowspanmethod({ row, $rowIndex, column, data }) {
            let fields = ["req_groupna"];
            let cellValue = row[column.property];
            let spec = row["specimen_code"];
            let groupid = row["req_groupid"];
            let barcode = row["barcode"];
            let barcode_hid = row["barcode_hid"];
            if (cellValue && fields.includes(column.property)) {
                let prevRow = null; //上一行
                let i= 1;
                while (prevRow == null && $rowIndex - i >=0 ){
                    prevRow = data[$rowIndex - i];
                    if(prevRow && prevRow["isShow"] == '1' || prevRow["is_used"]){
                        prevRow = null;
                    }
                    i++;
                }
                let nextrowindex = $rowIndex + 1;
                let nextRow = null; //下一行
                while (nextRow == null && nextrowindex < data.length ){
                    nextRow = data[nextrowindex];
                    if(nextRow && nextRow["isShow"] == '1' || nextRow["is_used"]){
                        nextRow = null;
                    }
                    nextrowindex++;
                }

                if(this.options.barcodeisorignalno == '1'){
                    if (prevRow && prevRow[column.property] === cellValue && prevRow["specimen_code"] === spec && prevRow["barcode"] == barcode ) {
                        return { rowspan: 0, colspan: 0 };
                    } else {
                        let countRowspan = 1;
                        while (nextRow && nextRow[column.property] === cellValue && nextRow["specimen_code"] === spec && nextRow["barcode"] == barcode) {
                            countRowspan++;
                            nextRow = null; //下一行的后面的数据
                            while (nextRow == null && nextrowindex < data.length ){
                                nextRow = data[nextrowindex];
                                if(nextRow && nextRow["isShow"] == '1' || nextRow["is_used"]){
                                    nextRow = null;
                                }
                                nextrowindex++;
                            }
                        }
                        if (countRowspan > 1) {
                            return { rowspan: countRowspan, colspan: 1 };
                        }
                    }
                }
                else{
                    if (prevRow && prevRow[column.property] === cellValue && prevRow["specimen_code"] === spec && prevRow["barcode_hid"] == barcode_hid) {
                        return { rowspan: 0, colspan: 0 };
                    } else {
                        let countRowspan = 1;
                        while (nextRow && nextRow[column.property] === cellValue && nextRow["specimen_code"] === spec && nextRow["barcode_hid"] == barcode_hid) {
                            countRowspan++;
                            nextRow = null; //下一行的后面的数据
                            while (nextRow == null && nextrowindex < data.length ){
                                nextRow = data[nextrowindex];
                                if(nextRow && nextRow["isShow"] == '1' || nextRow["is_used"]){
                                    nextRow = null;
                                }
                                nextrowindex++;
                            }
                        }
                        if (countRowspan > 1) {
                            return { rowspan: countRowspan, colspan: 1 };
                        }
                    }
                }
            }
        },
        repalceComputerName(row) {
            this.$pub.getComputerName(row.mac_address)
                .then((name)=> {
                    row.computer_name = name;
                })
                .catch(()=> {
                    this.$message.error("机器名称查询失败！");
                    //保持原样
                });
        },
    },
    beforeRouteEnter(to, from, next) {
        next((vm) => {
            // 通过 `vm` 访问组件实例
            let that = vm;
            let arr = []; //组合按键 暂时支持alt吧 将来可以扩展
            document.onkeydown = function (e) {
                let key = window.event.keyCode;
                //console.log("key=", key);
                if (arr.length > 0) {
                    //65到90 a到z（A到Z）
                    if (key == 67) {
                        //alert("复位");
                        //that.btnreset_click();
                    } else if (key == 66) {
                        // alert("单打条码");
                    } else if (key == 76) {
                        //alert("重打回单");
                    }
                } else {
                    //112到135 F1到F24
                    if (key == that.options.readcardkey) {
                        that.readcard();
                    } else if (key == that.options.printkey) {
                        if (that.prtbtndisabled == false) {
                            that.btnPrint_click();
                        }
                    } else if (key == that.options.querykey) {
                        that.txtinputno_enter('1');
                    } else if (key == 18) {
                        //按下了alt
                        arr.push(key);
                    }
                    else if (key == 120) {
                        //排队叫号-呼叫下一个（F9）
                        if (that.showcallwindow){
                            that.callnextone();
                        }
                    }
                    else if (key == 121) {
                        //排队叫号-重呼（F10）
                        if (that.showcallwindow){
                            that.recall();
                        }
                    }
                    else if (key == 122) {
                        //排队叫号-过号（F11）
                        if (that.showcallwindow){
                            //that.passcall();
                        }
                    }
                }
            };
            document.onkeyup = function (e) {
                let key = window.event.keyCode;
                if (key == 18) {
                    arr = [];
                }
                // else if (key == 13) {
                //     if (this.prebarcodemode != "1" && this.cxenterprint=="1" && this.prtbtndisabled==false) {
                //         //生成条码后默认回车打印（打印条码模式）
                //         this.btnPrint_click();
                //     }
                // }
            };
        });
    },
    beforeDestroy(){
        this.$bus.$off("imagecatch");
        this.$bus.$off("browsermsg");
    }
};
</script>
<style scoped>
.table1style tr td {
    font-size: 12px;
    padding: 0px 2px 0px 2px;
}
::v-deep .reportlogclass {
    color: blue;
    font-style: italic;
    font-size: 10px;
}
.csstxtbarsacn ::v-deep .el-input__inner {
    color: red;
}
.redc {
    color: red !important;
}
.qdradio {
    width: 23px;
}
.showbottleno {
    margin-left: 4px;
}
::v-deep .req110top {
    vertical-align: top !important;
}
::v-deep .showbottleno .el-input__inner {
    color: #000000 !important;
}
::v-deep .el-tabs__item.is-disabled {
    padding: 0px 5px;
}
.btntable td {
    padding-left: 10px;
}
::v-deep .el-textarea__inner {
    padding: 0px 5px !important;
}

::v-deep .check-row {
    background-color: #91bcf3;
}

.msgTipTitle{
    background-color: #91bcf3;
    height: 24px;
    color: black;
    font-size: 17px;
    font-weight: 500;
    border-radius: 50px;
}

.msgTipSpan{
    padding-left: 20px;
}

.msgTipWords {
    height: 120px;
    width: 100%;
    overflow: auto;
    padding-left: 20px;
    padding-right: 10px;
    padding-top: 5px;
}
</style>

